package Ġdev . pat rick gold . fl or is board . ime . text . nlp Ċ Ċ import Ġdev . pat rick gold . fl or is board . ime . nlp . N gram Node Ċ import Ġdev . pat rick gold . fl or is board . ime . nlp . N gram Tree Ċ import Ġdev . pat rick gold . fl or is board . ime . nlp . Suggestion List Ċ import Ġorg . hamcrest . Core Matchers .` is ` Ċ import Ġorg . hamcrest . Core Matchers . null Value Ċ import Ġorg . hamcrest . Matcher Assert . assertThat Ċ import Ġorg . junit . Test Ċ Ċ class ĠN gram Node Test Ġ{ ĊĠĠĠ Ġprivate Ġval Ġn gram Tree ToBe Tested Ġ= ĠN gram Tree ( high er Order Children Ġ= Ġmutable Map Of ( ĊĠĠĠĠĠĠĠ ĠPair (' t ', ĠN gram Node ( 1 , Ġ' t ', Ġ" t ", ĠN gram Node . FREQ _ CHARACTER , Ġsame Order Children Ġ= Ġmutable Map Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPair (' h ', ĠN gram Node ( 1 , Ġ' h ', Ġ" th ", ĠN gram Node . FREQ _ CHARACTER , Ġsame Order Children Ġ= Ġmutable Map Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (' e ', ĠN gram Node ( 1 , Ġ' e ', Ġ" the ", Ġ 2 5 5 , Ġsame Order Children Ġ= Ġmutable Map Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (' m ', ĠN gram Node ( 1 , Ġ' m ', Ġ" them ", Ġ 2 3 0 )), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (' r ', ĠN gram Node ( 1 , Ġ' r ', Ġ" ther ", ĠN gram Node . FREQ _ CHARACTER , Ġsame Order Children Ġ= Ġmutable Map Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (' e ', ĠN gram Node ( 1 , Ġ' e ', Ġ" there ", Ġ 2 1 0 )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ))) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ)) ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPair (' o ', ĠN gram Node ( 1 , Ġ' o ', Ġ" to ", Ġ 2 2 0 )) ĊĠĠĠĠĠĠĠ Ġ))) ĊĠĠĠ Ġ)) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġfind Word _ returns Correct Node _ for Existing Word () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= Ġn gram Tree ToBe Tested . high er Order Children [' t ']. same Order Children . get (' h '). same Order Children . get (' e ') ĊĠĠĠĠĠĠĠ Ġval Ġactual Ġ= Ġn gram Tree ToBe Tested . find Word (" the ") ĊĠĠĠĠĠĠĠ ĠassertThat ( actual , Ġ` is `( expected )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġfind Word _ returns Null _ for Non Existing () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġn gram Tree ToBe Tested . find Word (" ther "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ` is `( null Value ()) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġn gram Tree ToBe Tested . find Word (" sun "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ` is `( null Value ()) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertThat ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġn gram Tree ToBe Tested . find Word (" th "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ` is `( null Value ()) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġlist All Same Order Words _ returns Correct List _ for Given Prefix () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġwords Ġ= ĠSuggest ion List < String , ĠInt >( 4 ) ĊĠĠĠĠĠĠĠ Ġn gram Tree ToBe Tested . high er Order Children [' t ']. list All Same Order Words ( words , Ġtrue ) ĊĠĠĠĠĠĠĠ ĠassertThat ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwords , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ` is `( Suggestion List < String , ĠInt >( 4 ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġadd (" the ", Ġ 2 5 5 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġadd (" them ", Ġ 2 3 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġadd (" to ", Ġ 2 2 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġadd (" there ", Ġ 2 1 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ class ĠFl or is Language Model Test Ċ