The SPECIALIST Lexicon API

The SPECIALIST Lexicon JAVA API使用

affix 为词缀,按缀位分为 prefix (前缀)和 suffix(后缀);
按缀形分成 inflection (屈折词)和 derivation (衍生词)
derivation 分为 prefix 和 suffix,如:happy 加suffix为happily,加prefix为unhappy.
inflection 只在词尾加词缀,表时态,数,格等变化,如:ask,asks,asking,asked,etc.

derivation 派生词 改变词性和语义

inflection 语法变化

LvgCmdApi

全部组件说明 lvg2021/docs/designDoc/UDF/flow/index.html

-f:a

缩写扩展

-f:b

uninflect a term 还原单词形态

it can make plural nouns in to singular nouns, inflected verbs into their infinitive forms, and adjectives and adverbs into their positive forms.

复数转换成单数,动词转换成不定式,副词形容词转换成原级(不能转换成名词)

-f:An 

Anti-Normalize (Approximate Match)

‎使用规范化术语作为输入返回词汇中的转换后的术语。可用作基本近似匹配。

‎在词典中找到近似匹配,可用于不规范术语转换

The order of the results is sorted by alphabetical, EUI, category, and then inflection.

String outputFromLvg = null;
LvgCmdApi lvgApi = new LvgCmdApi("-f:An", "D:/lvg2021/data/config/lvg.properties");

// ---------------------------------       
// process each term
// ---------------------------------
outputFromLvg = lvgApi.MutateToString("term");

-f:d

Generate derivational variants

生成派生词

派生规则文件 lvg2021/docs/designDoc/UDF/derivations/index.html

Derivational variants are generated by FACTs (a pre-computed derivational table) and morphology rules (RULEs). Facts are stored in database and retrieved by SQL query. RULEs are stored and retrieved through Trie mechanism.

派生转换由FACT(预计算的派生表)和形态规则(RULEs)生成。FACTs存储在数据库中,由SQL查询检索。RULEs通过Trie机制存储和检索。

-f:dc~数字

以数字指定派生词词性

CategoryValue
adj1
adv2
aux4
compl8
conj16
det32
modal64
noun128
prep256
pron512
verb

1024

String outputFromLvg = null;
LvgCmdApi lvgApi = new LvgCmdApi("-f:dc~128", "D:/lvg2021/data/config/lvg.properties");
outputFromLvg = lvgApi.MutateToString(w);
String[] outs = outputFromLvg.split("\n");
if (outputFromLvg.length()>0) {
    for (String out : outs) {
        derivword.add(out.split("\\|")[1]);
                }
            }

-f:d kdt:STR

限制派生类型

  • Z (zeroD): restricts the outputs zero derivations of the input.无变化
  • S (suffixD): restricts the outputs suffix derivations of the input. 后缀
  • P (prefixD): restricts the outputs prefix derivations of the input. 前缀
  • ZS (zeroD and suffixD): restricts the outputs zero and suffix derivations of the input. This is one of the most used options with query expansion for CUI mapping. 
  • ZP (zeroD and prefixD): restricts the outputs zero and prefix derivations of the input.
  • SP (suffixD and prefixD): restricts the outputs suffix and prefix derivations of the input.
  • ZSP (all): No restriction on the outputs on derivation type. All zeroD (Z), suffixD (S), and prefixD (P) are displayed. This is the default option.

-f:f

 Filter output to contain only forms from the lexicon.

过滤词典中不存在的,只返回一条记录

inflection输出过滤 -k:i:1 

输出派生变体过滤 -k:d:1

-f:i

Generate inflectional variants

生成屈折变体

-f:Ln

从数据库中检索单词类别(词性)和变体信息

-f:nom

Retrieve nominalizations form for an input term.

输入的标准化形式

-f:N3

=LuiNorm?

normalize non-ASCII Unicode characters to ASCII, remove genitives, then remove parenthetic plural forms, then replace punctuations with spaces, then remove stop words, then lowercase, then uninflected words, then take each of the normalized uninflected words and map them to their canonical form, then strip or map non-ASCII Unicode characters to ASCII, and then word order sort.

非ASCII字符转换,删除所有格,删除括号复数,替换标点符号为空格,小写,词形还原,转为正式名称,排序单词

-f:r

递归生成同义词

Norm API

lvg2021/docs/userDoc/examples/norm.html

同 -f:q0:g:rs:o:t:l:B:Ct:q7:q8:w

  1. q0: map Unicode symbols and punctuation to ASCII
  2. g: remove genitives,
  3. rs: then remove parenthetic plural forms of (s), (es), (ies), (S), (ES), and (IES),
  4. o: then replace punctuation with spaces,
  5. t: then remove stop words,
  6. l: then lowercase,
  7. B: then uninflect each word,
  8. Ct: then get citation form for each base form,
  9. q7: then Unicode Core Norm
  10. q8: then strip or map non-ASCII Unicode characters,
  11. w: and finally sort the words in alphabetic order.

生成的单词有可能不存在于词典中

right经norm后成ride 

import java.util.*;
import gov.nih.nlm.nls.lvg.Api.*;

public class Normalization
{
    // test driver
    public static void main(String[] args)
    {
        // instantiate a LvgApi object by config file
        String lvgConfigFile
            = "/export/home/lu/Projects/LVG/lvg2012/data/config/lvg.properties";
        NormApi normApi = new NormApi(lvgConfigFile);

        // Process the inflectional variants mutation
        String in = "left"; // use lexItem as input to lvgApi
        try
        {
            Vector outs = normApi.Mutate(in);

            // PrintOut the Result
            for(String out: outs)
            {
                System.out.println(in + "|" + out);
            }

            // clean up
            normApi.CleanUp();
        }
        catch (Exception e)
        {
            System.err.println("** ERR: " + e.toString());
        }
    }
}

输出形式

Field 1Field 2Field 3Field 4Field 5Field 6Field 7+
InputOutput TermCategoriesInflectionsFlow HistoryFlow NumberAdditional Information

output term:转换后的术语

categories:

BitValueVariantOther SymbolsExample
01adj
  • adjective
  • ADJ
  • red
12adv
  • adverb
  • ADV
  • quickly
24aux
  • auxiliary
  • be
  • is
  • are
  • do
  • have
  • has
38compl
  • complementizer
  • that
416conj
  • conjunction
  • CON
  • con
  • and
  • or
  • but
532det
  • determiner
  • DET
  • a
  • the
  • some
  • each
664modal.
  • can
  • dare
  • may
  • must
  • ought
  • shall
  • will
7128noun
  • NOM
  • NPR
  • dog
8256prep
  • preposition
  • PRE
  • pre
  • to
  • on
  • in
  • at
  • by
9512pron
  • pronoun
  • it
  • he
  • they
101024verb
  • VER
  • ver
  • break

inflection:

 

BitValueVariantOther SymbolsExample
01base.
  • dog
  • break
  • red
  • quickly
12comparative 比较级.
  • redder
24superlative 最高级.
  • reddest
38plural 复数
  • p
  • dogs
416presPart 现在分词
  • ing
  • breaking
532past 过去式.
  • broke
664pastPart  过去分词.
  • broken
7128pres3s 现在第三人称单数.
  • breaks
8256positive.
  • red
9512singular
  • s
  • dog
101024infinitive
  • inf
  • break
112048pres123p.
  • break
124096pastNeg.
  • didn't
  • couldn't
  • wouldn't
  • shouldn't
138192pres123pNeg.
  • don't
  • won't
1416384pres1s.
  • am
1532768past1p23pNeg.
  • weren't
1665536past1p23p.
  • were
17131072past1s3sNeg.
  • wasn't
18262144pres1p23p.
  • are
19524288pres1p23pNeg.
  • aren't
201048576past1s3s.
  • was
212097152pres.
  • can
224194304pres3sNeg.
  • isn't
  • hasn't
238388608presNeg.
  • can't
  • cannot

where:

  • pres: present
  • past: past
  • Part: participle
  • 1: first personal
  • 2: second personal
  • 3: third personal
  • s: singular
  • p: plural
  • Neg: Negative

additional information:-m

 

Sub-Term Mapping Tools (SMTM)

Sub-Term Mapping Tools (nih.gov)

LexItem Sub-Term Finder (LSF):

  • to find if a term is in the Lexicon
  • to find all sub-terms are in the Lexicon
  • to find all prefix sub-terms are in the Lexicon
  • to find the longest prefix sub-term in the Lexicon
//判断语料库中是否存在该词
LsfApi lsfApi = new LsfApi("D:/stmt2015/data/config/lsf.properties");

String isincorpus = lsfApi.CheckInCorpus("alis");
//前缀? 对于单独的单词好像无法识别前缀
Vector<String> prefixes = lsfApi.FindPrefixes("cricoarytenoid");

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值