本文整理汇总了Java中simplenlg.phrasespec.NPPhraseSpec.addComplement方法的典型用法代码示例。如果您正苦于以下问题:Java NPPhraseSpec.addComplement方法的具体用法?Java NPPhraseSpec.addComplement怎么用?Java NPPhraseSpec.addComplement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simplenlg.phrasespec.NPPhraseSpec
的用法示例。
在下文中一共展示了NPPhraseSpec.addComplement方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEx02
import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
/**
* This example shows: a) preposition contraction: em + uma = numa b) no
* preposition contraction: de + São João = de + São João d) preposition
* contraction: em + o = no e) preposition contraction: de + a = da
*/
@Test
public void testEx02() {
NPPhraseSpec subject = this.phraseFactory.createNounPhrase("meus", "amigo");
subject.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
VPPhraseSpec verb = this.phraseFactory.createVerbPhrase("estar");
NPPhraseSpec place = this.phraseFactory.createNounPhrase("uma", "festa");
PPPhraseSpec placePhrase = this.phraseFactory.createPrepositionPhrase("em", place);
NPPhraseSpec type = this.phraseFactory.createNounPhrase("São João");
PPPhraseSpec typePhrase = this.phraseFactory.createPrepositionPhrase("de", type);
place.addComplement(typePhrase);
SPhraseSpec s = this.phraseFactory.createClause(subject, verb, placePhrase);
Assert.assertEquals("Meus amigos estão numa festa de São João.", getResult(s, "02a"));
NPPhraseSpec subject2 = this.phraseFactory.createNounPhrase("eu");
VPPhraseSpec verb2 = this.phraseFactory.createVerbPhrase("estar");
NPPhraseSpec place2 = this.phraseFactory.createNounPhrase("o", "quarto");
PPPhraseSpec place2Phrase = this.phraseFactory.createPrepositionPhrase("em", place2);
NPPhraseSpec place3 = this.phraseFactory.createNounPhrase("a", "minha casa");
PPPhraseSpec place3Phrase = this.phraseFactory.createPrepositionPhrase("de", place3);
place2.addComplement(place3Phrase);
SPhraseSpec s2 = this.phraseFactory.createClause(subject2, verb2, place2Phrase);
Assert.assertEquals("Eu estou no quarto da minha casa.", getResult(s2, "02b"));
}
示例2: testEx35
import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx35() {
NPPhraseSpec np = this.phraseFactory.createNounPhrase("você");
VPPhraseSpec vp = this.phraseFactory.createVerbPhrase("passar");
vp.setFeature(Feature.PROSPECTIVE, true);
PPPhraseSpec pp = this.phraseFactory.createPrepositionPhrase("por");
NPPhraseSpec np2 = this.phraseFactory.createNounPhrase("o", "bairro");
PPPhraseSpec pp2 = this.phraseFactory.createPrepositionPhrase("entre");
NPPhraseSpec np3 = this.phraseFactory.createNounPhrase("as", "parada");
np3.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
np3.addPostModifier("3 e 4");
pp2.addComplement(np3);
np2.addComplement(pp2);
pp.addComplement(np2);
vp.addComplement(pp);
SPhraseSpec s = this.phraseFactory.createClause(np, vp);
Assert.assertEquals("Você vai passar pelo bairro entre as paradas 3 e 4.", getResult(s));
}
示例3: testEx08
import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx08() {
NPPhraseSpec np = this.phraseFactory.createNounPhrase("prato");
np.setSpecifier("vários");
np.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
PPPhraseSpec pp = this.phraseFactory.createPrepositionPhrase("a");
NPPhraseSpec np2 = this.phraseFactory.createNounPhrase("mesa");
np2.setSpecifier("a");
pp.addComplement(np2);
np.addComplement(pp);
Assert.assertEquals("Vários pratos à mesa.", getResult(np));
}
示例4: testEx10
import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx10() {
NPPhraseSpec np = this.phraseFactory.createNounPhrase("proximidade");
np.setSpecifier("a");
PPPhraseSpec pp = this.phraseFactory.createPrepositionPhrase("com");
NPPhraseSpec np2 = this.phraseFactory.createNounPhrase("natureza");
np2.setSpecifier("a");
pp.addComplement(np2);
np.addComplement(pp);
Assert.assertEquals("A proximidade com a natureza.", getResult(np));
}
示例5: testEx18
import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx18() {
NPPhraseSpec np = this.phraseFactory.createNounPhrase("rua");
np.setSpecifier("as");
np.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
PPPhraseSpec pp = this.phraseFactory.createPrepositionPhrase("ao redor de");
NPPhraseSpec np2 = this.phraseFactory.createNounPhrase("praça");
np2.setSpecifier("a");
pp.addComplement(np2);
np.addComplement(pp);
Assert.assertEquals("As ruas ao redor da praça.", getResult(np));
}
示例6: testEx20
import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx20() {
NPPhraseSpec np = this.phraseFactory.createNounPhrase("lugar");
np.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
AdvPhraseSpec ap = this.phraseFactory.createAdverbPhrase("aqui perto");
np.addComplement(ap);
Assert.assertEquals("Lugares aqui perto.", getResult(np));
}
示例7: testEx28
import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx28() {
NPPhraseSpec np = this.phraseFactory.createNounPhrase("o", "andar");
// traditional grammars label 'de cima' as an 'adverbial complex',
// even though in this case it modifies a noun.
AdvPhraseSpec ap = this.phraseFactory.createAdverbPhrase("de cima");
np.addComplement(ap);
Assert.assertEquals("O andar de cima.", getResult(np));
}
示例8: testEx30
import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx30() {
NPPhraseSpec np = this.phraseFactory.createNounPhrase("o", "lago");
PPPhraseSpec pp = this.phraseFactory.createPrepositionPhrase("de");
pp.addComplement(np);
NPPhraseSpec np2 = this.phraseFactory.createNounPhrase("a", "beira");
np2.addComplement(pp);
Assert.assertEquals("A beira do lago.", getResult(np2));
}