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


Java SPhraseSpec.setFeature方法代码示例

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


在下文中一共展示了SPhraseSpec.setFeature方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testEx01

import simplenlg.phrasespec.SPhraseSpec; //导入方法依赖的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

示例2: testEx04

import simplenlg.phrasespec.SPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx04() {
	// TODO it should be possible to pack the subject "quem gosta" within
	// a VP instead of within an NP, as it is. Something in the French
	// grammar messes with the syntax if one does this.
	NPPhraseSpec subject = this.phraseFactory.createNounPhrase("quem gosta");
	NPPhraseSpec object = this.phraseFactory.createNounPhrase("capela");
	object.setSpecifier("a");

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

	Assert.assertEquals("Quem gosta deve visitar a capela.", getResult(s));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:15,代码来源:Testbed.java

示例3: testEx05

import simplenlg.phrasespec.SPhraseSpec; //导入方法依赖的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

示例4: testEx07

import simplenlg.phrasespec.SPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx07() {
	PPPhraseSpec pp = this.phraseFactory.createPrepositionPhrase("a");
	NPPhraseSpec np = this.phraseFactory.createNounPhrase("direita");
	np.setSpecifier("a");
	pp.addComplement(np);

	SPhraseSpec s = this.phraseFactory.createClause(null, "virar", pp);
	s.setFeature(Feature.TENSE, Tense.IMPERATIVE);

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

示例5: testEx09

import simplenlg.phrasespec.SPhraseSpec; //导入方法依赖的package包/类
@Test
public void testEx09() {
	NPPhraseSpec np = this.phraseFactory.createNounPhrase("quem gosta");
	NPPhraseSpec np2 = this.phraseFactory.createNounPhrase("ponte");
	np2.setSpecifier("a");

	SPhraseSpec s = this.phraseFactory.createClause(np, "cruzar", np2);
	s.setFeature(Feature.MODAL, "poder");

	Assert.assertEquals("Quem gosta pode cruzar a ponte.", getResult(s));
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:12,代码来源:Testbed.java

示例6: testEx12

import simplenlg.phrasespec.SPhraseSpec; //导入方法依赖的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

示例7: main

import simplenlg.phrasespec.SPhraseSpec; //导入方法依赖的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);

}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:55,代码来源:SingleExample.java


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