analysis-ik icon indicating copy to clipboard operation
analysis-ik copied to clipboard

关于分词,自定义词典以后还是会拆出单字?

Open crossmaya opened this issue 1 year ago • 1 comments

'analyzer' => 'ik_max_word', 'text' => '我爱迪丽热巴'

'爱迪', '热', '巴' 怎么能屏蔽掉呢?

Array ( [tokens] => Array ( [0] => Array ( [token] => 我爱 [start_offset] => 0 [end_offset] => 2 [type] => CN_WORD [position] => 0 )

        [1] => Array
            (
                [token] => 爱迪
                [start_offset] => 1
                [end_offset] => 3
                [type] => CN_WORD
                [position] => 1
            )

        [2] => Array
            (
                [token] => 迪丽热巴
                [start_offset] => 2
                [end_offset] => 6
                [type] => CN_WORD
                [position] => 2
            )

        [3] => Array
            (
                [token] => 热
                [start_offset] => 4
                [end_offset] => 5
                [type] => CN_WORD
                [position] => 3
            )

        [4] => Array
            (
                [token] => 巴
                [start_offset] => 5
                [end_offset] => 6
                [type] => CN_CHAR
                [position] => 4
            )

    )

)

crossmaya avatar Dec 01 '23 08:12 crossmaya

使用ik_smart应该就可以了吧

Emptyrain avatar Jan 03 '24 03:01 Emptyrain