use of com.sri.ai.praise.core.representation.interfacebased.factor.api.ModelLanguage in project aic-praise by aic-sri-international.
the class PRAiSECommandLineOptions method getLanguageFromInputFilesWithDefaultPRAiSEFileExtension.
private ModelLanguage getLanguageFromInputFilesWithDefaultPRAiSEFileExtension() {
ModelLanguage result;
result = inputFiles.stream().filter(fileHasPRAiSEFileDefaultExtension).map(fromPRAiSEFileToLanguage).findFirst().orElse(null);
return result;
}
use of com.sri.ai.praise.core.representation.interfacebased.factor.api.ModelLanguage in project aic-praise by aic-sri-international.
the class PRAiSECommandLineOptions method findLanguageModel.
private static ModelLanguage findLanguageModel(String languageCode) {
List<ModelLanguage> modelLanguages = Arrays.asList(ModelLanguage.values());
ModelLanguage result = getFirstSatisfyingPredicateOrNull(modelLanguages, hasLanguageCode(languageCode));
return result;
}
use of com.sri.ai.praise.core.representation.interfacebased.factor.api.ModelLanguage in project aic-praise by aic-sri-international.
the class PRAiSECommandLineOptions method getLanguageFromPRAiSEFile.
private static ModelLanguage getLanguageFromPRAiSEFile(File praiseFile) {
List<ModelPage> modelPages = getModelPagesFromURI(praiseFile.toURI());
ModelLanguage modelLanguage = Util.getFirstNonNullResultOrNull(modelPages, m -> m.getLanguage());
return modelLanguage;
}
use of com.sri.ai.praise.core.representation.interfacebased.factor.api.ModelLanguage in project aic-praise by aic-sri-international.
the class TranslatorFactory method newTranslator.
/**
* Instantiate a new Translator based on the given source->target mapping.
* @param source
* the source modeling language to translate from.
* @param target
* the target modeling language to translate to.
* @return a new Translator instance capable of translating source->target
* @throws RuntimeException if unable to instantiate a translator for the given source and target.
*/
public static Translator newTranslator(ModelLanguage source, ModelLanguage target) {
Translator result = null;
Class<?> translatorClass = _translators.get(new Pair<ModelLanguage, ModelLanguage>(source, target));
try {
result = (Translator) translatorClass.newInstance();
} catch (Exception ex) {
throw new RuntimeException("Unable to create a new translator for " + source + "->" + target, ex);
}
return result;
}
use of com.sri.ai.praise.core.representation.interfacebased.factor.api.ModelLanguage in project aic-praise by aic-sri-international.
the class PRAiSECommandLineOptions method getLanguageMatchingExtensionOfSomeInputFile.
private ModelLanguage getLanguageMatchingExtensionOfSomeInputFile() {
List<ModelLanguage> modelLanguages = Arrays.asList(ModelLanguage.values());
ModelLanguage result = getFirstSatisfyingPredicateOrNull(modelLanguages, isExtensionForSomeOfTheInputFiles());
return result;
}
Aggregations