当前位置: 首页>>代码示例>>Java>>正文


Java NPPhraseSpec.setFeature方法代码示例

本文整理汇总了Java中simplenlg.phrasespec.NPPhraseSpec.setFeature方法的典型用法代码示例。如果您正苦于以下问题:Java NPPhraseSpec.setFeature方法的具体用法?Java NPPhraseSpec.setFeature怎么用?Java NPPhraseSpec.setFeature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在simplenlg.phrasespec.NPPhraseSpec的用法示例。


在下文中一共展示了NPPhraseSpec.setFeature方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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"));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:31,代码来源:Testbed.java

示例2: testEx03

import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的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"));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:24,代码来源:Testbed.java

示例3: testEx17

import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的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));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:17,代码来源:Testbed.java

示例4: testEx17b

import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的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));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:17,代码来源:Testbed.java

示例5: testEx17c

import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的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));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:17,代码来源:Testbed.java

示例6: 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));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:20,代码来源:Testbed.java

示例7: testEx58

import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx58() {
	NPPhraseSpec np = this.phraseFactory.createNounPhrase("o", "local");
	np.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
	VPPhraseSpec vp = this.phraseFactory.createVerbPhrase("estar");
	AdvPhraseSpec ap = this.phraseFactory.createAdverbPhrase("espalhado");
	ap.addPreModifier("um pouco");
	SPhraseSpec s = this.phraseFactory.createClause(np, vp, ap);

	// TODO this example generates an ill-formed clause but, in the way
	// the grammar currently is, neither (a) determiner-noun agreement
	// happens, nor (b) subject-predicate agreement of copula clauses.
	// commented out is the realisation one wishes to get.
	Assert.assertEquals(
			// "os locais estão um pouco espalhados",
			"O locais estão um pouco espalhado.", getResult(s));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:18,代码来源:Testbed.java

示例8: testEx01

import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
/**
 * This example shows: a) -ão plural: folião + PLURAL = foliões b) -al
 * plural: arraial + PLURAL = arraiais c) verb periphrasis build: foliões
 * animados + gostar + brincar = foliões animados gostam de brincar
 */
@Test
public void testEx01() {
	NPPhraseSpec subject = this.phraseFactory.createNounPhrase("folião");
	subject.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
	subject.addPostModifier("animados");
	VPPhraseSpec verb = this.phraseFactory.createVerbPhrase("brincar");
	verb.setFeature(Feature.MODAL, "gostar");
	NPPhraseSpec object = this.phraseFactory.createNounPhrase("em", "arraial");
	object.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
	SPhraseSpec s = this.phraseFactory.createClause(subject, verb, object);

	Assert.assertEquals("Foliões animados gostam de brincar em arraiais.", getResult(s, "01"));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:19,代码来源:Testbed.java

示例9: testEx01

import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx01() {
	NPPhraseSpec subject = this.phraseFactory.createNounPhrase("eles");
	NPPhraseSpec object = this.phraseFactory.createNounPhrase("receita");
	object.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
	object.setSpecifier("as");

	SPhraseSpec s = this.phraseFactory.createClause(subject, "trazer", object);
	s.setFeature(Feature.TENSE, Tense.PAST);

	Assert.assertEquals("Eles trouxeram as receitas.", getResult(s));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:13,代码来源:Testbed.java

示例10: testEx05

import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx05() {
	NPPhraseSpec subject = this.phraseFactory.createNounPhrase("morador");
	subject.setSpecifier("os");
	subject.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
	NPPhraseSpec object = this.phraseFactory.createNounPhrase("cidade");
	object.setSpecifier("a");

	SPhraseSpec s = this.phraseFactory.createClause(subject, "atravessar", object);
	s.setFeature(Feature.MODAL, "precisar");

	Assert.assertEquals("Os moradores precisam atravessar a cidade.", getResult(s));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:14,代码来源:Testbed.java

示例11: 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));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:14,代码来源:Testbed.java

示例12: testEx12

import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx12() {
	NPPhraseSpec np = this.phraseFactory.createNounPhrase("as crianças");
	np.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
	SPhraseSpec s = this.phraseFactory.createClause(np, "seguir", "a trilha");
	s.setFeature(Feature.TENSE, Tense.PERSONAL_INFINITIVE);

	Assert.assertEquals("As crianças seguirem a trilha.", getResult(s));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:10,代码来源:Testbed.java

示例13: 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));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:14,代码来源:Testbed.java

示例14: 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));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:10,代码来源:Testbed.java

示例15: testEx24

import simplenlg.phrasespec.NPPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx24() {
	NPPhraseSpec np = this.phraseFactory.createNounPhrase("as", "igreja");
	np.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);
	VPPhraseSpec vp = this.phraseFactory.createVerbPhrase("dividir");
	NPPhraseSpec np2 = this.phraseFactory.createNounPhrase("espaço");
	vp.addComplement(np2);
	PPPhraseSpec pp = this.phraseFactory.createPrepositionPhrase("com");
	NPPhraseSpec np3 = this.phraseFactory.createNounPhrase("a", "casa");
	pp.addComplement(np3);
	SPhraseSpec s = this.phraseFactory.createClause(np, vp, pp);

	Assert.assertEquals("As igrejas dividem espaço com a casa.", getResult(s));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:15,代码来源:Testbed.java


注:本文中的simplenlg.phrasespec.NPPhraseSpec.setFeature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。