Giter Club home page Giter Club logo

Comments (2)

dongrixinyu avatar dongrixinyu commented on August 13, 2024
text = '明天上午8点到9点开会,这种9点会解析成今天的9点'
res = jio.ner.extract_time(text, with_parsing=True, ret_all=True)
[
    {
        "text":"明天上午8点到9点",
        "offset":[
            0,
            9
        ],
        "type":"time_span",
        "detail":{
            "type":"time_span",
            "definition":"accurate",
            "time":[
                "2021-10-22 08:00:00",
                "2021-10-22 09:00:00"
            ]
        }
    },
    {
        "text":"9点",
        "offset":[
            14,
            16
        ],
        "type":"time_point",
        "detail":{
            "type":"time_point",
            "definition":"accurate",
            "time":[
                "2021-10-21 09:00:00",
                "2021-10-21 09:59:59"
            ]
        }
    },
    {
        "text":"今天的9点",
        "offset":[
            20,
            25
        ],
        "type":"time_point",
        "detail":{
            "type":"time_point",
            "definition":"accurate",
            "time":[
                "2021-10-21 09:00:00",
                "2021-10-21 09:59:59"
            ]
        }
    }
]
text = '下午3点开会,提前20分钟提醒我,之后20分钟也会解析成3点'
res = jio.ner.extract_time(text, with_parsing=True, ret_all=True)
[
    {
        "text":"下午3点",
        "offset":[
            0,
            4
        ],
        "type":"time_point",
        "detail":{
            "type":"time_point",
            "definition":"accurate",
            "time":[
                "2021-10-21 15:00:00",
                "2021-10-21 15:59:59"
            ]
        }
    },
    {
        "text":"20分钟",
        "offset":[
            9,
            13
        ],
        "type":"time_delta",
        "detail":{
            "type":"time_delta",
            "definition":"accurate",
            "time":{
                "minute":20.0
            }
        }
    },
    {
        "text":"20分钟",
        "offset":[
            19,
            23
        ],
        "type":"time_delta",
        "detail":{
            "type":"time_delta",
            "definition":"accurate",
            "time":{
                "minute":20.0
            }
        }
    },
    {
        "text":"3点",
        "offset":[
            28,
            30
        ],
        "type":"time_point",
        "detail":{
            "type":"time_point",
            "definition":"accurate",
            "time":[
                "2021-10-21 03:00:00",
                "2021-10-21 03:59:59"
            ]
        }
    }
]

看下你的代码版本。看起来没有问题。

from jionlp.

dongrixinyu avatar dongrixinyu commented on August 13, 2024

优先从 git 拉代码

from jionlp.

Related Issues (20)

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.