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


Java Lexicon类代码示例

本文整理汇总了Java中simplenlg.lexicon.Lexicon的典型用法代码示例。如果您正苦于以下问题:Java Lexicon类的具体用法?Java Lexicon怎么用?Java Lexicon使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TripleConverterPortuguese

import simplenlg.lexicon.Lexicon; //导入依赖的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();
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:27,代码来源:TripleConverterPortuguese.java

示例2: TripleConverter

import simplenlg.lexicon.Lexicon; //导入依赖的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();
}
 
开发者ID:dice-group,项目名称:BENGAL,代码行数:27,代码来源:TripleConverter.java

示例3: main

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

示例4: init

import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
@BeforeClass
public static void init() throws Exception {
	KS.init();

	converter = new TripleConverterPortuguese(KS.getQueryExecutionFactory(), "cache", (Lexicon) null);

	r = new Realiser();
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:9,代码来源:TripleConverterTest.java

示例5: DocumentGeneratorPortuguese

import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
public DocumentGeneratorPortuguese(SparqlEndpoint endpoint, String cacheDirectory, Lexicon lexicon) {
	this(new QueryExecutionFactoryHttp(endpoint.getURL().toString(), endpoint.getDefaultGraphURIs()),
			cacheDirectory, lexicon);
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:5,代码来源:DocumentGeneratorPortuguese.java

示例6: main

import simplenlg.lexicon.Lexicon; //导入依赖的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

示例7: DocumentGenerator

import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
public DocumentGenerator(SparqlEndpoint endpoint, String cacheDirectory) {
	this(endpoint, cacheDirectory, Lexicon.getDefaultLexicon());
}
 
开发者ID:dice-group,项目名称:BENGAL,代码行数:4,代码来源:DocumentGenerator.java

示例8: SNLGRealizer

import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
public SNLGRealizer(LangMap nlMap, Lexicon lexicon) {
	this.nlMap = nlMap;
	this.lexicon = lexicon;
	nlgFactory = new NLGFactory(lexicon);
	realiser = new Realiser();
}
 
开发者ID:kariminf,项目名称:nalangen,代码行数:7,代码来源:SNLGRealizer.java

示例9: EngRealizer

import simplenlg.lexicon.Lexicon; //导入依赖的package包/类
public EngRealizer() {
	super(new EngSnlgMap(), Lexicon.getDefaultLexicon());
}
 
开发者ID:kariminf,项目名称:nalangen,代码行数:4,代码来源:EngRealizer.java


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