日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

Java Word break analysis

發布時間:2023/12/19 java 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Java Word break analysis 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Created by Wang, Jerry, last modified on Dec 18, 2015

in getAllPossibleSentences, s: catsanddog pos: 9
Sub string: catsanddog
逐一遍歷字典里的word,檢查當前子串是否以word結尾。
Sub String ends with word in Dict!: dog - 字典里找到一個匹配。
current position: 9 word length: 3
first Seg end: 6 找到匹配后準備開始遞歸。
RECURSIVELY call, new position: 6
in getAllPossibleSentences, s: catsanddog pos: 6 - 傳s還是傳整個字符串進去,只是position變成前6個。此時執行流不會返回,仍然是在當前dog匹配的大前提下。
Sub string: catsand
Sub String ends with word in Dict!: sand
current position: 6 word length: 4
first Seg end: 2
RECURSIVELY call, new position: 2 又找到一個匹配,再遞歸。
in getAllPossibleSentences, s: catsanddog pos: 2
Sub string: cat
Sub String ends with word in Dict!: cat - 再次找到匹配 dog->sand->cat
current position: 2 word length: 3
first Seg end: -1
RECURSIVELY call, new position: -1
in getAllPossibleSentences, s: catsanddog pos: -1
pos is -1, we can return now and have a rest! return result size: 1 - 這個是默認的space
result from getAllPossible with position: -1 - 從最內層的遞歸返回了一層。
result list’s item is STRING.space, so I directly insert end word to solution list: cat - 將最內層的cat結果加到list里。
Possible solution FOUND:!cat
insert map with position: 2 possible list: 1
[-1, “”]
[2, cat]
result from getAllPossible with position: 2
item in result list: cat - 從前一個遞歸insert的。Current word in dic: sand - 當前遞歸frame的單詞。
Possible solution FOUND:!cat sand
Sub String ends with word in Dict!: and (Sub string: catsand)
current position: 6 word length: 3
first Seg end: 3
RECURSIVELY call, new position: 3
in getAllPossibleSentences, s: catsanddog pos: 3
Sub string: cats
Sub String ends with word in Dict!: cats
current position: 3 word length: 4
first Seg end: -1
RECURSIVELY call, new position: -1
in getAllPossibleSentences, s: catsanddog pos: -1
pos is -1, we can return now and have a rest! return result size: 1
result from getAllPossible with position: -1
item in result list: Current word in dic: cats
result list’s item is STRING.space, so I directly insert end word to solution list: cats
Possible solution FOUND:!cats
insert map with position: 3 possible list: 1
result from getAllPossible with position: 3
item in result list: catsCurrent word in dic: and
Possible solution FOUND:!cats and
insert map with position: 6 possible list: 2
result from getAllPossible with position: 6
item in result list: cat sandCurrent word in dic: dog
Possible solution FOUND:!cat sand dog
item in result list: cats andCurrent word in dic: dog
Possible solution FOUND:!cats and dog
insert map with position: 9 possible list: 2
result: cat sand dog
result: cats and dog



























總結

以上是生活随笔為你收集整理的Java Word break analysis的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。