Coder Social home page Coder Social logo

bert-bilstm-crf-ner's Introduction

fork from https://github.com/macanv/BERT-BiLSTM-CRF-NER

原程序弊端(Motivation)

原程序作为服务时可提供API被其他程序调用。但是在做NER时,返回的只是标签序列,我们并不知道NER程序对于输入文本是如何分词(tokenlize)的。

原程序例:

input:

{"id": 123,"texts": ["1992/6,小明在Stanford University攻读CS专业"]}

output:

{
    "id": 123,
    "result": [
        [
            "B-TIME",
            "I-TIME",
            "I-TIME",
            "O",
            "B-PEOPLE",
            "I-PEOPLE",
            "O",
            "B-ORGANIZATION",
            "I-ORGANIZATION",
            "I-ORGANIZATION",
            "I-ORGANIZATION",
            "B-VERB",
            "I-VERB",
            "B-POSITION",
            "I-POSITION",
            "I-POSITION"
        ]

    ],
    "status": 200
}

修改(Modify)

参考原作者对分类型任务的输出处理,增加了对分词结果(tokens)的输出,方便客户端使用

修改后输出:

{
    "id": 123,
    "result": [
        {
            "tags": [
                [
                    "B-TIME",
                    "I-TIME",
                    "I-TIME",
                    "O",
                    "B-PEOPLE",
                    "I-PEOPLE",
                    "O",
                    "B-ORGANIZATION",
                    "I-ORGANIZATION",
                    "I-ORGANIZATION",
                    "I-ORGANIZATION",
                    "B-VERB",
                    "I-VERB",
                    "B-POSITION",
                    "I-POSITION",
                    "I-POSITION"
                ]
            ],
            "tokens": [
                [
                    "1992",
                    "/",
                    "6",
                    "",
                    "",
                    "",
                    "",
                    "st",
                    "##an",
                    "##ford",
                    "university",
                    "",
                    "",
                    "cs",
                    "",
                    ""
                ]
            ]
        }
    ],
    "status": 200
}

bert-bilstm-crf-ner's People

Contributors

lonelyhentxi avatar macanv avatar nobrowning avatar oasis-0927 avatar scievan avatar wenlisong avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.