【问题标题】:CRF model trained on plural, not working on singular使用复数训练的 CRF 模型,不适用于单数
【发布时间】:2017-05-13 19:56:57
【问题描述】:

我已经制作了一个 CRF 模型。我的数据集有 24 个类,此时我刚刚开始,所以我的训练数据只有 1200 个标记/语料库。我已经训练了模型。在我的训练数据中,我使用了复数形式的标记,例如地址、照片、州、国家等。

现在在测试时,如果我给这个模型以句子形式的复数标记,那么它工作得很好,但是如果我以单数形式输入我的句子,比如照片、状态等,那么它不会给它分配任何标签。

crf 的这种行为看起来很奇怪。我已经探索了NER Feature Factory 并使用了一些引理功能,但它也没有用。分享我的austen.prop 用于模型形成。

# location of the training file
trainFile = training_data_for_ner.txt
# location where you would like to save (serialize) your
# classifier; adding .gz at the end automatically gzips the file,
# making it smaller, and faster to load
serializeTo = ner-model.ser.gz

# structure of your training file; this tells the classifier that
# the word is in column 0 and the correct answer is in column 1
map = word=0,answer=1,pos=2,lemma=3

# This specifies the order of the CRF: order 1 means that features
# apply at most to a class pair of previous class and current class
# or current class and next class.
maxLeft=1

# these are the features we'd like to train with
# some are discussed below, the rest can be
# understood by looking at NERFeatureFactory
useClassFeature=true
useWord=true
# word character ngrams will be included up to length 6 as prefixes
# and suffixes only 
useNGrams=true
noMidNGrams=true
maxNGramLeng=6
usePrev=true
useNext=true
useDisjunctive=true
useSequences=true
usePrevSequences=true
# the last 4 properties deal with word shape features
useTypeSeqs=true
useTypeSeqs2=true
useTypeySequences=true
wordShape=chris2useLC
# newly added features.
useLemmas=true
usePrevNextLemmas=true
useLemmaAsWord=true
useTags=true

通过阅读 NER Feature Factory 添加了最后四个功能。如果有人能帮我解决这个问题,我将不胜感激。

【问题讨论】:

    标签: nlp stanford-nlp crf


    【解决方案1】:

    您应该使用词干标记重新训练它。以https://github.com/stanfordnlp/CoreNLP/blob/master/src/edu/stanford/nlp/process/Stemmer.javamain方法)为例。

    【讨论】:

    • 我可以同时保留引理和词干标记吗? crf模型形成会好吗?
    • 这取决于您的数据集。我猜你不应该那样做。请注意,您始终可以通过交叉验证检查质量(F1 分数或类似分数),并选择最合适的选项。
    • 我将如何向我的地图指定此特定列包含词干标记?假设训练文件中的第 5 列包含词干标记,那么我应该如何在 austen.prop 中编写我的地图。 map = ...... stem = 4 或 stemmer=4 ?
    • 我认为你应该用词干替换你的training_data_for_ner.txt。就我个人而言,我以编程方式访问了 StanfordNLP,并且对 austen.prop 没有太多经验,对此感到抱歉。
    猜你喜欢
    • 2017-08-11
    • 2017-08-19
    • 2018-10-23
    • 1970-01-01
    • 1970-01-01
    • 2016-10-19
    • 1970-01-01
    • 2020-12-15
    • 1970-01-01
    相关资源
    最近更新 更多