本文整理汇总了Java中simplenlg.lexicon.Lexicon类的典型用法代码示例。如果您正苦于以下问题:Java Lexicon类的具体用法?Java Lexicon怎么用?Java Lexicon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Lexicon类属于simplenlg.lexicon包,在下文中一共展示了Lexicon类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TripleConverterPortuguese
import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
public TripleConverterPortuguese(QueryExecutionFactory qef, PropertyVerbalizerPortuguese propertyVerbalizer,
IRIConverter uriConverter, String cacheDirectory, Dictionary wordnetDirectory, Lexicon lexicon) {
if (uriConverter == null) {
uriConverter = new DefaultIRIConverterPortuguese(qef, cacheDirectory);
}
this.uriConverter = uriConverter;
if (propertyVerbalizer == null) {
propertyVerbalizer = new PropertyVerbalizerPortuguese(uriConverter, wordnetDirectory);
}
pp = propertyVerbalizer;
if (lexicon == null) {
lexicon = new XMLLexicon();
}
nlgFactory = new NLGFactory(lexicon);
realiser = new Realiser();
literalConverter = new LiteralConverterPortuguese(uriConverter);
literalConverter.setEncapsulateStringLiterals(encapsulateStringLiterals);
reasoner = new SPARQLReasoner(qef);
genderDetector = new DictionaryBasedGenderDetector();
}
示例2: TripleConverter
import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
public TripleConverter(QueryExecutionFactory qef, PropertyVerbalizer propertyVerbalizer, IRIConverter uriConverter,
String cacheDirectory, Dictionary wordnetDirectory, Lexicon lexicon) {
if (uriConverter == null) {
uriConverter = new DefaultIRIConverter(qef, cacheDirectory);
}
this.uriConverter = uriConverter;
if (propertyVerbalizer == null) {
propertyVerbalizer = new PropertyVerbalizer(uriConverter, wordnetDirectory);
}
pp = propertyVerbalizer;
if (lexicon == null) {
lexicon = Lexicon.getDefaultLexicon();
}
nlgFactory = new NLGFactory(lexicon);
realiser = new Realiser(lexicon);
literalConverter = new LiteralConverter(uriConverter);
literalConverter.setEncapsulateStringLiterals(encapsulateStringLiterals);
reasoner = new SPARQLReasoner(qef);
genderDetector = new DictionaryBasedGenderDetector();
}
示例3: main
import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// int dummy = System.in.read();
long startTime;
long endTime;
double elapsed;
Realiser realiser = new Realiser();
System.out.println("constructing lexicon");
startTime = System.nanoTime();
Lexicon lexicon = new XMLLexicon();
endTime = System.nanoTime();
elapsed = (endTime - startTime) / 1000000000.0;
System.out.println("lexicon constructed");
System.out.println("elapsed time: " + elapsed + " seconds\n");
NLGFactory phraseFactory = new NLGFactory(lexicon);
VPPhraseSpec caber = phraseFactory.createVerbPhrase("caber");
caber.setFeature(Feature.TENSE, Tense.PRESENT);
caber.setFeature(Feature.PERSON, Person.FIRST);
caber.setFeature(Feature.NUMBER, NumberAgreement.SINGULAR);
System.out.println("realising example");
startTime = System.nanoTime();
String r = realiser.realise(caber).getRealisation();
endTime = System.nanoTime();
elapsed = (endTime - startTime) / 1000000000.0;
System.out.println("example realised");
System.out.println("elapsed time: " + elapsed + " seconds\n");
}
示例4: init
import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
@BeforeClass
public static void init() throws Exception {
KS.init();
converter = new TripleConverterPortuguese(KS.getQueryExecutionFactory(), "cache", (Lexicon) null);
r = new Realiser();
}
示例5: DocumentGeneratorPortuguese
import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
public DocumentGeneratorPortuguese(SparqlEndpoint endpoint, String cacheDirectory, Lexicon lexicon) {
this(new QueryExecutionFactoryHttp(endpoint.getURL().toString(), endpoint.getDefaultGraphURIs()),
cacheDirectory, lexicon);
}
示例6: main
import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
// Lexicon lexicon = Lexicon.getDefaultLexicon();
Lexicon lexicon = new XMLLexicon();
NLGFactory nlgFactory = new NLGFactory(lexicon);
Realiser realiser = new Realiser();
// realiser.setDebugMode(true);
SPhraseSpec ex = nlgFactory.createClause();
NPPhraseSpec locatum = nlgFactory.createNounPhrase("edifício");
// System.out.println(ex+"\n");
locatum.setSpecifier("o");
// System.out.println(ex+"\n");
ex.setSubject(locatum);
ex.setVerb("ficar");
PPPhraseSpec generalizedLocation = nlgFactory.createPrepositionPhrase();
NPPhraseSpec relatum = nlgFactory.createNounPhrase("praça");
relatum.setSpecifier("a");
generalizedLocation.addComplement(relatum);
generalizedLocation.setPreposition("em");
// System.out.println(ex+"\n");
ex.addComplement(generalizedLocation);
// System.out.println(ex+"\n");
// System.out.println(locatum+"\n");
// System.out.println(generalizedLocation+"\n");
String target = "O edifício fica na praça.";
String gloss = "The building lies at the square.";
String output = realiser.realiseSentence(ex);
if (!output.equals(target)) {
System.out.println("* " + output + " TARGET: " + target);
} else {
System.out.println(output + " (" + gloss + ")");
}
// EX100
String target100 = "Mariah Carey é uma cantora.";
String gloss100 = "Mariah Carey is a singer.";
SPhraseSpec ex100 = nlgFactory.createClause();
NPPhraseSpec subject100 = nlgFactory.createNounPhrase("Mariah Carey");
// subject100.setFeature(Feature.PERSON, Person.THIRD);
ex100.setSubject(subject100);
ex100.setVerb("ser");
ex100.setFeature(Feature.TENSE, Tense.PRESENT);
NPPhraseSpec object100 = nlgFactory.createNounPhrase("cantor");
object100.setFeature(LexicalFeature.GENDER, Gender.FEMININE);
object100.setSpecifier("um");
ex100.setObject(object100);
String output100 = realiser.realiseSentence(ex100);
System.out.println(output100);
}
示例7: DocumentGenerator
import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
public DocumentGenerator(SparqlEndpoint endpoint, String cacheDirectory) {
this(endpoint, cacheDirectory, Lexicon.getDefaultLexicon());
}
示例8: SNLGRealizer
import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
public SNLGRealizer(LangMap nlMap, Lexicon lexicon) {
this.nlMap = nlMap;
this.lexicon = lexicon;
nlgFactory = new NLGFactory(lexicon);
realiser = new Realiser();
}
示例9: EngRealizer
import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
public EngRealizer() {
super(new EngSnlgMap(), Lexicon.getDefaultLexicon());
}