本文整理汇总了Java中simplenlg.framework.NLGFactory类的典型用法代码示例。如果您正苦于以下问题:Java NLGFactory类的具体用法?Java NLGFactory怎么用?Java NLGFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NLGFactory类属于simplenlg.framework包,在下文中一共展示了NLGFactory类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TripleConverterPortuguese
import simplenlg.framework.NLGFactory; //导入依赖的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: setUp
import simplenlg.framework.NLGFactory; //导入依赖的package包/类
/**
* Set up the variables we'll need for this SimpleNLG test to run (Called
* automatically by JUnit)
*/
@Override
@Before
protected void setUp() {
lexicon = new XMLLexicon();
this.phraseFactory = new NLGFactory(this.lexicon);
this.realiser = new Realiser();
this.cantar = this.phraseFactory.createVerbPhrase("cantar");
this.vender = this.phraseFactory.createVerbPhrase("vender");
this.partir = this.phraseFactory.createVerbPhrase("partir");
this.estar = this.phraseFactory.createVerbPhrase("estar");
this.caber = this.phraseFactory.createVerbPhrase("caber");
this.fazer = this.phraseFactory.createVerbPhrase("fazer");
this.ouvir = this.phraseFactory.createVerbPhrase("ouvir");
}
示例3: setUp
import simplenlg.framework.NLGFactory; //导入依赖的package包/类
/**
* Set up the variables we'll need for this SimpleNLG test to run (Called
* automatically by JUnit)
*/
@Override
@Before
protected void setUp() {
lexicon = new XMLLexicon();
this.phraseFactory = new NLGFactory(this.lexicon);
this.realiser = new Realiser();
this.cantar = this.phraseFactory.createVerbPhrase("cantar");
this.vender = this.phraseFactory.createVerbPhrase("vender");
this.partir = this.phraseFactory.createVerbPhrase("partir");
this.eu = this.phraseFactory.createNounPhrase("eu");
this.tu = this.phraseFactory.createNounPhrase("tu");
this.voce = this.phraseFactory.createNounPhrase("você");
this.ela = this.phraseFactory.createNounPhrase("ela");
this.ele = this.phraseFactory.createNounPhrase("ele");
this.nos = this.phraseFactory.createNounPhrase("nós");
this.aGente = this.phraseFactory.createNounPhrase("a gente");
this.vos = this.phraseFactory.createNounPhrase("vós");
this.voces = this.phraseFactory.createNounPhrase("vocês");
this.elas = this.phraseFactory.createNounPhrase("elas");
this.eles = this.phraseFactory.createNounPhrase("eles");
this.clause = this.phraseFactory.createClause();
}
示例4: setUp
import simplenlg.framework.NLGFactory; //导入依赖的package包/类
/**
* Set up the variables we'll need for this simplenlg.test to run (Called
* automatically by JUnit)
*/
@Override
@Before
protected void setUp() {
lexicon = new XMLLexicon();
this.phraseFactory = new NLGFactory(this.lexicon);
this.realiser = new Realiser();
this.aPP = this.phraseFactory.createPrepositionPhrase("a");
this.dePP = this.phraseFactory.createPrepositionPhrase("de");
this.emPP = this.phraseFactory.createPrepositionPhrase("em");
this.porPP = this.phraseFactory.createPrepositionPhrase("por");
this.proximoAPP = this.phraseFactory.createPrepositionPhrase("próximo a");
this.longeDePP = this.phraseFactory.createPrepositionPhrase("longe de");
this.contraPP = this.phraseFactory.createPrepositionPhrase("contra");
this.paraPP = this.phraseFactory.createPrepositionPhrase("para");
this.desdePP = this.phraseFactory.createPrepositionPhrase("desde");
this.homen = this.phraseFactory.createNounPhrase("o", "homen");
this.mulher = this.phraseFactory.createNounPhrase("a", "mulher");
this.esteHomen = this.phraseFactory.createNounPhrase("este", "homen");
this.istoAqui = this.phraseFactory.createNounPhrase("isto", "aqui");
this.umaMulher = this.phraseFactory.createNounPhrase("uma", "mulher");
}
示例5: TripleConverter
import simplenlg.framework.NLGFactory; //导入依赖的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();
}
示例6: main
import simplenlg.framework.NLGFactory; //导入依赖的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");
}
示例7: setUp
import simplenlg.framework.NLGFactory; //导入依赖的package包/类
/**
* Set up the variables we'll need for this simplenlg.test to run (Called
* automatically by JUnit)
*/
@Override
@Before
protected void setUp() {
lexicon = new XMLLexicon();
this.phraseFactory = new NLGFactory(this.lexicon);
this.realiser = new Realiser();
}
示例8: setUp
import simplenlg.framework.NLGFactory; //导入依赖的package包/类
/**
* Set up the variables we'll need for this SimpleNLG test to run (Called
* automatically by JUnit)
*/
@Override
@Before
protected void setUp() {
lexicon = new XMLLexicon();
this.phraseFactory = new NLGFactory(this.lexicon);
this.realiser = new Realiser();
this.livro = this.phraseFactory.createNounPhrase("livro");
this.cidadao = this.phraseFactory.createNounPhrase("cidadão");
this.capitao = this.phraseFactory.createNounPhrase("capitão");
this.leao = this.phraseFactory.createNounPhrase("leão");
this.papel = this.phraseFactory.createNounPhrase("papel");
this.fossil = this.phraseFactory.createNounPhrase("fóssil");
this.funil = this.phraseFactory.createNounPhrase("funil");
this.carnaval = this.phraseFactory.createNounPhrase("carnaval");
this.dom = this.phraseFactory.createNounPhrase("dom");
this.especimen = this.phraseFactory.createNounPhrase("espécimen");
this.abdomen = this.phraseFactory.createNounPhrase("abdômen");
this.cor = this.phraseFactory.createNounPhrase("cor");
this.lapis = this.phraseFactory.createNounPhrase("lápis");
this.fregues = this.phraseFactory.createNounPhrase("freguês");
this.torax = this.phraseFactory.createNounPhrase("tórax");
this.luz = this.phraseFactory.createNounPhrase("luz");
this.juiz = this.phraseFactory.createNounPhrase("juiz");
}
示例9: setUp
import simplenlg.framework.NLGFactory; //导入依赖的package包/类
/**
* Set up the variables we'll need for this simplenlg.test to run (Called
* automatically by JUnit)
*/
@Override
@Before
protected void setUp() {
// lexicon = new
// XMLLexicon("src/simplenlg/lexicon/portuguese/default-portuguese-lexicon.xml");
// // TODO not sure if this is doing anything
lexicon = new XMLLexicon();
// lexicon = Lexicon.getDefaultLexicon();
// System.out.print(lexicon);
this.phraseFactory = new NLGFactory(this.lexicon);
this.realiser = new Realiser();
}
示例10: DocumentGeneratorPortuguese
import simplenlg.framework.NLGFactory; //导入依赖的package包/类
public DocumentGeneratorPortuguese(QueryExecutionFactory qef, String cacheDirectory, Lexicon lexicon) {
tripleConverter = new TripleConverterPortuguese(qef, null, null, cacheDirectory, null, lexicon);
nlgFactory = new NLGFactory(lexicon);
realiser = new Realiser();
}
示例11: main
import simplenlg.framework.NLGFactory; //导入依赖的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);
}
示例12: DocumentGenerator
import simplenlg.framework.NLGFactory; //导入依赖的package包/类
public DocumentGenerator(QueryExecutionFactory qef, String cacheDirectory, Lexicon lexicon) {
tripleConverter = new TripleConverter(qef, null, null, cacheDirectory, null, lexicon);
nlgFactory = new NLGFactory(lexicon);
realiser = new Realiser(lexicon);
}
示例13: SNLGRealizer
import simplenlg.framework.NLGFactory; //导入依赖的package包/类
public SNLGRealizer(LangMap nlMap, Lexicon lexicon) {
this.nlMap = nlMap;
this.lexicon = lexicon;
nlgFactory = new NLGFactory(lexicon);
realiser = new Realiser();
}