public class Utility extends Object
| Constructor and Description |
|---|
Utility() |
| Modifier and Type | Method and Description |
|---|---|
static Set<String> |
combineNER(String[] nerArray,
NERTagSet tagSet) |
static void |
convertPKUtoCWS(String inputFolder,
String outputFile,
int begin,
int end)
将人民日报格式的分词语料转化为空格分割的语料
|
static void |
convertPKUtoPOS(String inputFolder,
String outputFile,
int begin,
int end)
将人民日报格式的分词语料转化为空格分割的语料
|
static List<String[]> |
convertSentenceToNER(Sentence sentence,
NERTagSet tagSet)
将句子转换为 (单词,词性,NER标签)三元组
|
static int[] |
evaluateCWS(String developFile,
PerceptronSegmenter segmenter) |
static Map<String,double[]> |
evaluateNER(NERecognizer recognizer,
String goldFile) |
static void |
normalize(Sentence sentence) |
static String |
normalize(String text) |
static double[] |
prf(int[] stat) |
static double[] |
prf(int goldTotal,
int predTotal,
int correct) |
static void |
printNERScore(Map<String,double[]> scores) |
static String[][] |
reshapeNER(List<String[]> ner) |
static void |
reshapeNER(List<String[]> collector,
String[] wordArray,
String[] posArray,
String[] tagArray) |
static void |
shuffleArray(int[] ar)
Fisher–Yates shuffle
|
static <T> void |
shuffleArray(T[] ar) |
static String[] |
toWordArray(List<Word> wordList) |
public static double[] prf(int[] stat)
public static double[] prf(int goldTotal,
int predTotal,
int correct)
public static void shuffleArray(int[] ar)
ar - public static <T> void shuffleArray(T[] ar)
public static void convertPKUtoCWS(String inputFolder, String outputFile, int begin, int end) throws IOException
inputFolder - 输入人民日报语料的上级目录(该目录下的所有文件都是一篇人民日报分词文章)outputFile - 输出一整个CRF训练格式的语料begin - 取多少个文档之后end - IOException - 转换过程中的IO异常public static void convertPKUtoPOS(String inputFolder, String outputFile, int begin, int end) throws IOException
inputFolder - 输入人民日报语料的上级目录(该目录下的所有文件都是一篇人民日报分词文章)outputFile - 输出一整个CRF训练格式的语料begin - 取多少个文档之后end - IOException - 转换过程中的IO异常public static int[] evaluateCWS(String developFile, PerceptronSegmenter segmenter) throws IOException
IOExceptionpublic static List<String[]> convertSentenceToNER(Sentence sentence, NERTagSet tagSet)
sentence - tagSet - public static void normalize(Sentence sentence)
public static Map<String,double[]> evaluateNER(NERecognizer recognizer, String goldFile)
public static void reshapeNER(List<String[]> collector, String[] wordArray, String[] posArray, String[] tagArray)
Copyright © 2014–2021 码农场. All rights reserved.