本文整理汇总了Java中edu.stanford.nlp.international.morph.MorphoFeatureSpecification.MorphoFeatureType.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java MorphoFeatureType.valueOf方法的具体用法?Java MorphoFeatureType.valueOf怎么用?Java MorphoFeatureType.valueOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.stanford.nlp.international.morph.MorphoFeatureSpecification.MorphoFeatureType
的用法示例。
在下文中一共展示了MorphoFeatureType.valueOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import edu.stanford.nlp.international.morph.MorphoFeatureSpecification.MorphoFeatureType; //导入方法依赖的package包/类
@Override
public void setup(File path, String... options) {
//Setup the Bies tag mapping
super.setup(path, new String[0]);
for(String opt : options) {
String[] optToks = opt.split(":");
if(optToks[0].equals("UniversalMap") && optToks.length == 2) {
loadUniversalMap(optToks[1]);
} else {
//Maybe it's a morphological feature
//Both of these calls will throw exceptions if the feature is illegal/invalid
MorphoFeatureType feat = MorphoFeatureType.valueOf(optToks[0]);
List<String> featVals = morphoSpec.getValues(feat);
morphoSpec.activate(feat);
}
}
}
示例2: fromTagString
import edu.stanford.nlp.international.morph.MorphoFeatureSpecification.MorphoFeatureType; //导入方法依赖的package包/类
/**
* Assumes that the tag string has been formed using a call to getTag(). As such,
* it removes the basic category from the feature string.
* <p>
* Note that this method returns a <b>new</b> MorphoFeatures object. As a result, it
* behaves like a static method, but is non-static so that subclasses can override
* this method.
*
* @param str
*/
public MorphoFeatures fromTagString(String str) {
List<String> feats = Arrays.asList(str.split("\\-"));
MorphoFeatures mFeats = new MorphoFeatures();
for(String fPair : feats) {
String[] keyValue = fPair.split(KEY_VAL_DELIM);
if(keyValue.length != 2)//Manual state split annotations
continue;
MorphoFeatureType fName = MorphoFeatureType.valueOf(keyValue[0].trim());
mFeats.addFeature(fName, keyValue[1].trim());
}
return mFeats;
}
示例3: setupMorphoFeatures
import edu.stanford.nlp.international.morph.MorphoFeatureSpecification.MorphoFeatureType; //导入方法依赖的package包/类
/**
* Configures morpho-syntactic annotations for POS tags.
*
* @param activeFeats A comma-separated list of feature values with names according
* to MorphoFeatureType.
*
*/
private String setupMorphoFeatures(String activeFeats) {
String[] feats = activeFeats.split(",");
morphoSpec = tlp.morphFeatureSpec();
for(String feat : feats) {
MorphoFeatureType fType = MorphoFeatureType.valueOf(feat.trim());
morphoSpec.activate(fType);
}
return morphoSpec.toString();
}