本文整理汇总了Java中simplenlg.features.Tense类的典型用法代码示例。如果您正苦于以下问题:Java Tense类的具体用法?Java Tense怎么用?Java Tense使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Tense类属于simplenlg.features包,在下文中一共展示了Tense类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEx03
import simplenlg.features.Tense; //导入依赖的package包/类
/**
* This example shows a long verb periphrasis.
*
*/
@Test
public void testEx03() {
NPPhraseSpec subject = this.phraseFactory.createNounPhrase("você");
VPPhraseSpec verb = this.phraseFactory.createVerbPhrase("criar");
verb.setFeature(Feature.NEGATED, true);
verb.setFeature(Feature.PROSPECTIVE, true);
verb.setFeature(Feature.PROGRESSIVE, "ficar");
NPPhraseSpec object = this.phraseFactory.createNounPhrase("exemplo");
object.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
SPhraseSpec s = this.phraseFactory.createClause(subject, verb, object);
NPPhraseSpec subject2 = this.phraseFactory.createNounPhrase("a", "festa");
VPPhraseSpec verb2 = this.phraseFactory.createVerbPhrase("acabar");
verb2.setFeature(Feature.TENSE, Tense.IMPERSONAL_INFINITIVE);
SPhraseSpec s2 = this.phraseFactory.createClause(subject2, verb2);
s.addPostModifier("até");
s.addPostModifier(s2);
Assert.assertEquals("Você não vai ficar criando exemplos até a festa acabar.", getResult(s, "03"));
}
示例2: testEx17
import simplenlg.features.Tense; //导入依赖的package包/类
@Test
public void testEx17() {
NPPhraseSpec np = this.phraseFactory.createNounPhrase("que");
VPPhraseSpec vp = this.phraseFactory.createVerbPhrase("instalar");
np.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
vp.setFeature(Feature.TENSE, Tense.PAST);
vp.setFeature(Feature.PASSIVE, true);
PPPhraseSpec pp = this.phraseFactory.createPrepositionPhrase("ao longo de");
NPPhraseSpec np2 = this.phraseFactory.createNounPhrase("calçadão");
np2.setSpecifier("o");
pp.addComplement(np2);
vp.addPostModifier(pp);
SPhraseSpec s = this.phraseFactory.createClause(np, vp);
Assert.assertEquals("Que foram instalados ao longo do calçadão.", getResult(s));
}
示例3: testEx17b
import simplenlg.features.Tense; //导入依赖的package包/类
@Test
public void testEx17b() {
NPPhraseSpec np = this.phraseFactory.createNounPhrase("que");
VPPhraseSpec vp = this.phraseFactory.createVerbPhrase("instalar");
np.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
vp.setFeature(Feature.TENSE, Tense.IMPERFECT);
vp.setFeature(Feature.PERFECT, true);
PPPhraseSpec pp = this.phraseFactory.createPrepositionPhrase("ao longo de");
NPPhraseSpec np2 = this.phraseFactory.createNounPhrase("calçadão");
np2.setSpecifier("o");
pp.addComplement(np2);
vp.addPostModifier(pp);
SPhraseSpec s = this.phraseFactory.createClause(np, vp);
Assert.assertEquals("Que tinham instalado ao longo do calçadão.", getResult(s));
}
示例4: testEx17c
import simplenlg.features.Tense; //导入依赖的package包/类
@Test
public void testEx17c() {
NPPhraseSpec np = this.phraseFactory.createNounPhrase("que");
VPPhraseSpec vp = this.phraseFactory.createVerbPhrase("instalar");
np.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
vp.setFeature(Feature.TENSE, Tense.PAST);
vp.setFeature(Feature.PROGRESSIVE, true);
PPPhraseSpec pp = this.phraseFactory.createPrepositionPhrase("ao longo de");
NPPhraseSpec np2 = this.phraseFactory.createNounPhrase("calçadão");
np2.setSpecifier("o");
pp.addComplement(np2);
vp.addPostModifier(pp);
SPhraseSpec s = this.phraseFactory.createClause(np, vp);
Assert.assertEquals("Que estiveram instalando ao longo do calçadão.", getResult(s));
}
示例5: testEx27
import simplenlg.features.Tense; //导入依赖的package包/类
@Test
public void testEx27() {
VPPhraseSpec vp = this.phraseFactory.createVerbPhrase("dar");
PPPhraseSpec pp = this.phraseFactory.createPrepositionPhrase("para");
VPPhraseSpec vp2 = this.phraseFactory.createVerbPhrase("ir");
vp2.setFeature(Feature.TENSE, Tense.IMPERSONAL_INFINITIVE);
PPPhraseSpec pp2 = this.phraseFactory.createPrepositionPhrase("de");
NPPhraseSpec np = this.phraseFactory.createNounPhrase("bar");
pp2.addComplement(np);
PPPhraseSpec pp3 = this.phraseFactory.createPrepositionPhrase("em");
pp3.addComplement(np);
vp2.addComplement(pp2);
vp2.addComplement(pp3);
pp.addComplement(vp2);
SPhraseSpec s = this.phraseFactory.createClause(vp, pp);
Assert.assertEquals("Dá para ir de bar em bar.", getResult(s));
}
示例6: getTense
import simplenlg.features.Tense; //导入依赖的package包/类
private Tense getTense(String word) {
String[] split = word.split(" ");
String verb = split[0];
if(verb.endsWith("ed") && split.length == 1) {
// probably past tense
return Tense.PAST;
} else {
return Tense.PRESENT;
}
}
示例7: main
import simplenlg.features.Tense; //导入依赖的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");
}
示例8: testProgressive
import simplenlg.features.Tense; //导入依赖的package包/类
@Test
public void testProgressive() {
cantar.setFeature(Feature.TENSE, Tense.FUTURE);
cantar.setFeature(Feature.PERSON, Person.THIRD);
cantar.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
cantar.setFeature(Feature.PROGRESSIVE, true);
String realisation = realiser.realise(cantar).getRealisation();
// System.out.println(realisation);
Assert.assertEquals("estarão cantando", realisation);
}
示例9: testAlternativeProgressive
import simplenlg.features.Tense; //导入依赖的package包/类
@Test
public void testAlternativeProgressive() {
cantar.setFeature(Feature.TENSE, Tense.FUTURE);
cantar.setFeature(Feature.PERSON, Person.SECOND);
cantar.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
cantar.setFeature(Feature.PROGRESSIVE, "continuar");
String realisation = realiser.realise(cantar).getRealisation();
// System.out.println(realisation);
Assert.assertEquals("continuareis cantando", realisation);
}
示例10: testPerfective
import simplenlg.features.Tense; //导入依赖的package包/类
@Test
public void testPerfective() {
cantar.setFeature(Feature.TENSE, Tense.IMPERFECT);
cantar.setFeature(Feature.PERSON, Person.FIRST);
cantar.setFeature(Feature.NUMBER, NumberAgreement.SINGULAR);
cantar.setFeature(Feature.PERFECT, true);
String realisation = realiser.realise(cantar).getRealisation();
// System.out.println(realisation);
Assert.assertEquals("tinha cantado", realisation);
}
示例11: testProspective
import simplenlg.features.Tense; //导入依赖的package包/类
@Test
public void testProspective() {
cantar.setFeature(Feature.TENSE, Tense.PRESENT);
cantar.setFeature(Feature.PERSON, Person.THIRD);
cantar.setFeature(Feature.NUMBER, NumberAgreement.SINGULAR);
cantar.setFeature(Feature.PROSPECTIVE, true);
String realisation = realiser.realise(cantar).getRealisation();
// System.out.println(realisation);
Assert.assertEquals("vai cantar", realisation);
}
示例12: testProgressiveProspective
import simplenlg.features.Tense; //导入依赖的package包/类
@Test
public void testProgressiveProspective() {
cantar.setFeature(Feature.TENSE, Tense.PRESENT);
cantar.setFeature(Feature.PERSON, Person.THIRD);
cantar.setFeature(Feature.NUMBER, NumberAgreement.SINGULAR);
cantar.setFeature(Feature.PROGRESSIVE, true);
cantar.setFeature(Feature.PROSPECTIVE, true);
String realisation = realiser.realise(cantar).getRealisation();
// System.out.println(realisation);
Assert.assertEquals("vai estar cantando", realisation);
}
示例13: testAlternativeProgressiveProspective
import simplenlg.features.Tense; //导入依赖的package包/类
@Test
public void testAlternativeProgressiveProspective() {
cantar.setFeature(Feature.TENSE, Tense.PRESENT);
cantar.setFeature(Feature.PERSON, Person.THIRD);
cantar.setFeature(Feature.NUMBER, NumberAgreement.SINGULAR);
cantar.setFeature(Feature.PROGRESSIVE, "viver");
cantar.setFeature(Feature.PROSPECTIVE, true);
String realisation = realiser.realise(cantar).getRealisation();
// System.out.println(realisation);
Assert.assertEquals("vai viver cantando", realisation);
}
示例14: testPerfectProspective
import simplenlg.features.Tense; //导入依赖的package包/类
@Test
public void testPerfectProspective() {
cantar.setFeature(Feature.TENSE, Tense.CONDITIONAL);
cantar.setFeature(Feature.PERSON, Person.FIRST);
cantar.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
cantar.setFeature(Feature.PERFECT, true);
cantar.setFeature(Feature.PROSPECTIVE, true);
String realisation = realiser.realise(cantar).getRealisation();
// System.out.println(realisation);
Assert.assertEquals("iríamos ter cantado", realisation);
}
示例15: testModal
import simplenlg.features.Tense; //导入依赖的package包/类
@Test
public void testModal() {
cantar.setFeature(Feature.TENSE, Tense.SUBJUNCTIVE_PRESENT);
cantar.setFeature(Feature.PERSON, Person.SECOND);
cantar.setFeature(Feature.NUMBER, NumberAgreement.SINGULAR);
cantar.setFeature(Feature.MODAL, "dever");
String realisation = realiser.realise(cantar).getRealisation();
// System.out.println(realisation);
Assert.assertEquals("devas cantar", realisation);
}