本文整理了Java中net.sf.extjwnl.data.Word
类的一些代码示例,展示了Word
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Word
类的具体详情如下:
包路径:net.sf.extjwnl.data.Word
类名称:Word
[英]A Word
represents the lexical information related to a specific sense of an IndexWord
. Word
's are linked by Pointers into a network of lexically related words. #getTargets retrieves the targets of these links, and Word#getPointers retrieves the pointers themselves.
[中]Word
表示与IndexWord
的特定意义相关的词汇信息。Word
通过指针链接到一个词汇相关单词的网络中#getTargets检索这些链接的目标,Word#getPointers检索指针本身。
代码示例来源:origin: hltfbk/Excitement-Open-Platform
/**
* @param words
* @param wordToLookup
* @return
*/
private Word lookupWordInWords(List
boolean found = false;
Word someWord = null;
for (int i = 0; i
someWord = words.get(i);
found = someWord.getLemma().equalsIgnoreCase(wordToLookup);
}
return someWord;
}
}
代码示例来源:origin: extjwnl/extjwnl
private static int getSenseNo(final Word word) throws JWNLException {
final IndexWord iw = word.getDictionary().getIndexWord(word.getPOS(), word.getLemma());
for (int i = 0; i
return i;
}
}
return -1;
}
代码示例来源:origin: de.tudarmstadt.ukp.uby/de.tudarmstadt.ukp.uby.integration.wordnet-gpl
@Override
public int compare(Word o1, Word o2) {
return o1.getSenseKey().compareTo(o2.getSenseKey());
}
});
代码示例来源:origin: extjwnl/extjwnl
/**
* Two words are equal if their parent Synsets are equal and they have the same lemma
*/
public boolean equals(Object object) {
return (object instanceof Word)
&& ((Word) object).getSynset().equals(getSynset())
&& ((Word) object).getLemma().equals(getLemma());
}
代码示例来源:origin: extjwnl/extjwnl
public String toString() {
return ResourceBundleSet.insertParams("[Word: {0} [Lemma: {1}] {2} [Index: {3}]]", new Object[]{getPOS(), getLemma(), getSynset(), getIndex()});
}
代码示例来源:origin: net.sf.extjwnl/extjwnl
private static int getUseCount(Synset synset, String lemma) {
for (Word w : synset.getWords()) {
if (w.getLemma().equalsIgnoreCase(lemma)) {
if (0
}
}
}
return 0;
}
代码示例来源:origin: apache/opennlp-sandbox
public static String getMostFrequentSense(WSDSample sample) {
List
for (Word wd : synsets.get(0).getWords()) {
if (wd.getLemma()
.equalsIgnoreCase((sample.getLemmas()[sample.getTargetPosition()]))) {
try {
return WSDParameters.SenseSource.WORDNET.name() + " "
+ wd.getSenseKey();
} catch (JWNLException e) {
e.printStackTrace();
}
}
}
return "nonesense";
}
代码示例来源:origin: net.sf.extjwnl/extjwnl-utilities
log.error("Duplicate sensekey for -add: {}", workWord.getSenseKey());
System.exit(1);
final Synset tempSynset = d.createSynset(pos);
log.info("Creating word {}...", lemma);
workWord = new Word(d, tempSynset, lemma);
workWord.setLexId(lexId);
tempSynset.getWords().add(workWord);
tempSynset.setLexFileNum(lexFileNum);
d.removeSynset(workWord.getSynset());
workWord = null;
key = null;
final Word tempWord = new Word(d, workWord.getSynset(), args[i].replace('_', ' '));
workWord.getSynset().getWords().add(tempWord);
key = null;
} else {
log.error("Missing word for addword command for sensekey {}", workWord.getSenseKey());
System.exit(1);
workWord.getSynset().getWords().remove(workWord);
key = null;
workWord.getSynset().setGloss(args[i]);
key = null;
} else {
log.error("Missing gloss for setgloss command for sensekey {}", workWord.getSenseKey());
System.exit(1);
代码示例来源:origin: net.sf.extjwnl/extjwnl
return o1.getSenseKeyWithAdjClass().compareTo(o2.getSenseKeyWithAdjClass());
} catch (JWNLException e) {
throw new JWNLRuntimeException(e);
s.append(word.getSenseKeyWithAdjClass()).
append(' ').append(word.getSenseNumber()).
append(' ').append(word.getUseCount());
int result = o2.getUseCount() - o1.getUseCount();
if (0 == result) {
try {
result = o2.getSenseKeyWithAdjClass().compareTo(o1.getSenseKeyWithAdjClass());
} catch (JWNLException e) {
throw new JWNLRuntimeException(e);
s.append(word.getUseCount()).
append(' ').append(word.getSenseKeyWithAdjClass()).
append(' ').append(word.getSenseNumber());
Synset synset = iw.getSenses().get(i);
for (Word w : synset.getWords()) {
if (w.getLemma().equalsIgnoreCase(iw.getLemma())) {
result.delete(0, result.length());
result.append(w.getSenseKey()).append(" ");
formatOffset(synset.getOffset(), offsetLength, result);
result.append(" ");
result.append(i + 1);
result.append(" ");
代码示例来源:origin: hltfbk/Excitement-Open-Platform
/**
* Ctor with an {@link Word} and a dictionary
* This Ctor is quicker than the other.
* @param jwiDictionary
* @throws WordNetException
*/
ExtJwnlSensedWord(Word wordObj, ExtJwnlDictionary extJwnlDictionary) throws WordNetException {
if (wordObj==null)
throw new WordNetException("wordObj is null!");
this.wordObj = wordObj;
this.synset = new ExtJwnlSynset(extJwnlDictionary, wordObj.getSynset());
this.word = wordObj.getLemma();
this.dictiOnary= extJwnlDictionary;
this.pos = ExtJwnlUtils.getWordNetPartOfSpeech( wordObj.getPOS());
}
代码示例来源:origin: de.tudarmstadt.ukp.uby/de.tudarmstadt.ukp.uby.integration.wordnet-gpl
if(!posSet){
lexicalEntry.setPartOfSpeech(WNConvUtil.getPOS(lexeme.getPOS()));
posSet = true;
lemmaString = lexeme.getLemma();
if(lePOS.equals(EPartOfSpeech.verb)){
String[] frames = lexeme.getSynset().getVerbFrames();
for(String frame : frames){
Map
if(lePOS.equals(EPartOfSpeech.adjective) && (synMarker = lexeme.getSenseKeyWithAdjClass()).contains("(")){
int start = synMarker.indexOf("(");
String adjFrameCode = synMarker.substring(start+1, synMarker.indexOf(")"));
代码示例来源:origin: net.sf.extjwnl/extjwnl
/**
* Returns the sense key of a lemma.
*
* @return sense key
* @throws JWNLException JWNLException
*/
public String getSenseKey() throws JWNLException {
int ss_type = getSynsetType();
final StringBuilder senseKey = startBuildingSenseKey(ss_type);
if (POS.ADJECTIVE_SATELLITE_ID == ss_type) {
List
if (0
List
if (0
senseKey.append(word.getLemma().toLowerCase().replace(' ', '_')).append(":");
if (word.getLexId() <10) {
senseKey.append("0");
}
senseKey.append(word.getLexId());
}
}
} else {
senseKey.append(":");
}
return senseKey.toString();
}
代码示例来源:origin: net.sf.extjwnl/extjwnl-utilities
synsetWordStmt.setInt(1, wordId);
synsetWordStmt.setString(3, word.getLemma());
synsetWordStmt.setInt(4, word.getIndex());
synsetWordStmt.setInt(5, word.getUseCount());
synsetWordStmt.setLong(6, word.getLexId());
synsetVerbFrameStmt.setInt(4, word.getIndex());
BitSet bits = ((Verb) word).getVerbFrameFlags();
for (int i = bits.nextSetBit(0); i >= 0; i = bits.nextSetBit(i + 1)) {
代码示例来源:origin: extjwnl/extjwnl
for (int i = 0; i
System.out.print(word.getLemma());
if (needLex && 0
System.out.print(" [" + word.getSenseKey() + "]");
代码示例来源:origin: de.tudarmstadt.ukp.dkpro.wsd/de.tudarmstadt.ukp.dkpro.wsd.si.wordnet
public CachedSense(String senseId)
throws SenseInventoryException
{
super(senseId);
try {
word = wn.getWordBySenseKey(senseId);
synset = word.getSynset();
pos = wordNetPosToSiPos.transform(word.getPOS());
useCount = word.getUseCount();
}
catch (JWNLException e) {
throw new SenseInventoryException(e);
}
}
代码示例来源:origin: extjwnl/extjwnl
private void addToIndexWords(Word word) {
if (null != dictionary && dictionary.isEditable()) {
try {
IndexWord iw = dictionary.getIndexWord(word.getPOS(), word.getLemma());
if (null == iw) {
dictionary.createIndexWord(word.getPOS(), word.getLemma(), Synset.this);
} else {
if (!iw.getSenses().contains(Synset.this)) {
iw.getSenses().add(Synset.this);
}
}
} catch (JWNLException e) {
throw new JWNLRuntimeException(e);
}
}
}
}
代码示例来源:origin: net.sf.extjwnl/extjwnl
for (Synset sense : iw.getSenses()) {
for (Word word : sense.getWords()) {
if (word.getLemma().equalsIgnoreCase(iw.getLemma())) {
List
list.add(word);
int maxId = -1;
for (Word word : list) {
if (maxId
if (-1 == word.getLexId()) {
maxId++;
word.setLexId(maxId);
代码示例来源:origin: net.sf.extjwnl/extjwnl
protected int getSynsetType() {
int ss_type = getPOS().getId();
if (POS.ADJECTIVE == getSynset().getPOS() && getSynset().isAdjectiveCluster()) {
ss_type = POS.ADJECTIVE_SATELLITE_ID;
}
return ss_type;
}
代码示例来源:origin: net.sf.extjwnl/extjwnl
String lemma = w.getLemma().replace(' ', '_');
if (w instanceof Adjective) {
Adjective a = (Adjective) w;
if (checkLexIdLimit && log.isWarnEnabled() && (0xF
new Object[]{synset.getOffset(), w.getLemma(), w.getLexId()}));
result.append(Long.toHexString(w.getLexId())).append(' ');
for (int i = bits.nextSetBit(0); i >= 0; i = bits.nextSetBit(i + 1)) {
if (!verbFrames.get(i)) {
if (checkVerbFrameLimit && log.isWarnEnabled() && (0xFF
new Object[]{synset.getOffset(), word.getIndex()}));
if (word.getIndex() <0x10) {
result.append("0");
result.append(Integer.toHexString(word.getIndex())).append(' ');
代码示例来源:origin: de.tudarmstadt.ukp.uby/de.tudarmstadt.ukp.uby.integration.wordnet-gpl
sense.setLexicalEntry(lexicalEntry);
String senseNumber = isr.getSenseNumber(lexeme.getSenseKey());
if(senseNumber != null){
int index = Integer.parseInt(senseNumber);
StringBuffer sb = new StringBuffer(128);
sb.append("IndexSenseReader did not provide sense number for senseKey ");
sb.append(lexeme.getSenseKey()).append('\n');
sb.append("adding a dummy value of sense number");
logger.warn(sb.toString());
net.sf.extjwnl.data.Synset lexemeSynset = lexeme.getSynset(); // lexemes Synset
sb.append(lexeme.getSynset().getPOS());
sb.append(" ");
sb.append(lexeme.getSenseKey());
monolingualExternalRef.setExternalSystem("WordNet 3.0 part of speech and sense key");
monolingualExternalRef.setExternalReference(sb.toString());