本文整理汇总了Java中ixa.kaflib.WF.getForm方法的典型用法代码示例。如果您正苦于以下问题:Java WF.getForm方法的具体用法?Java WF.getForm怎么用?Java WF.getForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ixa.kaflib.WF
的用法示例。
在下文中一共展示了WF.getForm方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filterTerms
import ixa.kaflib.WF; //导入方法依赖的package包/类
public static List<Term> filterTerms(final Iterable<Term> terms) {
final List<Term> result = Lists.newArrayList();
boolean atBeginning = true;
for (final Term term : Ordering.from(Term.OFFSET_COMPARATOR).sortedCopy(terms)) {
final char pos = Character.toUpperCase(term.getPos().charAt(0));
if (atBeginning && (pos == 'D' || pos == 'P')) {
continue;
}
for (final WF word : term.getWFs()) {
final String text = word.getForm();
if (SYMBOLS.contains(text) || !WF_EXCLUSION_PATTERN.matcher(text).matches()) {
result.add(term);
atBeginning = false;
break;
}
}
}
return result;
}
示例2: getText
import ixa.kaflib.WF; //导入方法依赖的package包/类
public String getText(){
String text = "";
int textOffset = 0;
List<WF> wordForms = kaf.getWFs();
for (int i = 0; i < wordForms.size(); i++) {
WF wordForm = wordForms.get(i);
if (textOffset != wordForm.getOffset()){
while(textOffset < wordForm.getOffset()) {
text += " ";
textOffset += 1;
}
}
text += wordForm.getForm();
textOffset += wordForm.getLength();
}
return text;
}
示例3: endOf
import ixa.kaflib.WF; //导入方法依赖的package包/类
private static int endOf(final Term term) {
final List<WF> wfs = term.getWFs();
final WF wf = wfs.get(wfs.size() - 1);
final String str = wf.getForm();
if (str.equals("-LSB-") || str.equals("-RSB-") || str.equals("''")) {
return wf.getOffset() + 1;
}
return wf.getOffset() + wf.getLength();
}
示例4: getEnd
import ixa.kaflib.WF; //导入方法依赖的package包/类
public static int getEnd(final Term term) {
final List<WF> wfs = term.getWFs();
final WF wf = wfs.get(wfs.size() - 1);
final String str = wf.getForm();
if (str.equals("-LSB-") || str.equals("-RSB-") || str.equals("''")) {
return wf.getOffset() + 1;
}
return wf.getOffset() + wf.getLength();
}
示例5: getText
import ixa.kaflib.WF; //导入方法依赖的package包/类
private static String getText(final List<Term> terms) {
final StringBuilder builder = new StringBuilder();
boolean atBeginning = true;
for (final Term term : terms) {
for (final WF word : term.getWFs()) {
final String s = word.getForm();
final boolean punct = ",".equals(s) || ";".equals(s) || ".".equals(s)
|| ":".equals(s);
builder.append(atBeginning || punct ? "" : " ");
builder.append(word.getForm());
atBeginning = false;
}
}
return builder.toString();
}