// ĠCopyright Ġ 2 0 0 0 - 2 0 2 0 ĠJetBrains Ġs . r . o . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ package Ġcom . intellij . internal . ml Ċ Ċ import Ġorg . junit . Test Ċ import Ġkotlin . test . assertEquals Ċ Ċ class ĠWord s Splitter Test Ġ{ ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` split Ġidentifier Ġon Ġwords Ġin Ġdifferent Ġcases `() Ġ{ ĊĠĠĠ Ġval Ġwords Splitter Ġ= ĠWord s Splitter . Builder (). toLowerCase (). build () ĊĠĠĠ Ġval Ġnames 2 words Ġ= Ġmap Of ( ĊĠĠĠĠĠ Ġ" camel Case Identifier " Ġto ĠlistOf (" camel ", Ġ" case ", Ġ" identifier "), ĊĠĠĠĠĠ Ġ" Pas cal Case Identifier " Ġto ĠlistOf (" pas cal ", Ġ" case ", Ġ" identifier "), ĊĠĠĠĠĠ Ġ" snake _ case _ identifier " Ġto ĠlistOf (" snake ", Ġ" case ", Ġ" identifier "), ĊĠĠĠĠĠ Ġ" Some _ different Cases _ Identifier " Ġto ĠlistOf (" some ", Ġ" different ", Ġ" cases ", Ġ" identifier "), ĊĠĠĠĠĠ Ġ" CAPS _ IDENTIFIER " Ġto ĠlistOf (" caps ", Ġ" identifier "), ĊĠĠĠĠĠ Ġ" identifier 1 2 3 with Numbers __ And # @ special ? symbols " Ġto ĠlistOf (" identifier ", Ġ" with ", Ġ" numbers ", Ġ" and ", Ġ" special ", Ġ" symbols "), ĊĠĠĠĠĠ Ġ" ML Completion " Ġto ĠlistOf (" ml ", Ġ" completion "), ĊĠĠĠĠĠ Ġ" Get HTML Report " Ġto ĠlistOf (" get ", Ġ" html ", Ġ" report "), ĊĠĠĠĠĠ Ġ" test " Ġto ĠlistOf (" test "), ĊĠĠĠĠĠ Ġ" test 5 " Ġto ĠlistOf (" test "), ĊĠĠĠĠĠ Ġ" 5 test !" Ġto ĠlistOf (" test "), ĊĠĠĠĠĠ Ġ" 5 5 5 test 5 5 5 " Ġto ĠlistOf (" test "), ĊĠĠĠĠĠ Ġ"_ test _" Ġto ĠlistOf (" test "), ĊĠĠĠĠĠ Ġ" 1 2 3 _ ? !" Ġto ĠlistOf () ĊĠĠĠ Ġ) ĊĠĠĠ Ġcheck Results ( words Splitter , Ġnames 2 words ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` skip Ġstop Ġwords `() Ġ{ ĊĠĠĠ Ġval Ġwords Splitter Ġ= ĠWord s Splitter . Builder (). ignore Stop Words (). toLowerCase (). build () ĊĠĠĠ Ġval Ġnames 2 words Ġ= Ġmap Of ( ĊĠĠĠĠĠ Ġ" get Some Information " Ġto ĠlistOf (" some ", Ġ" information "), ĊĠĠĠĠĠ Ġ" get _ some _ information " Ġto ĠlistOf (" some ", Ġ" information "), ĊĠĠĠĠĠ Ġ" setValue " Ġto ĠlistOf (" value "), ĊĠĠĠĠĠ Ġ" is _ correct " Ġto ĠlistOf (" correct ") ĊĠĠĠ Ġ) ĊĠĠĠ Ġcheck Results ( words Splitter , Ġnames 2 words ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` don 't Ġprocess Ġtoo Ġmany Ġwords `() Ġ{ ĊĠĠĠ Ġval Ġwords Splitter Ġ= ĠWord s Splitter . Builder (). max Words ( 5 ). toLowerCase (). build () ĊĠĠĠ Ġval Ġnames 2 words Ġ= Ġmap Of ( ĊĠĠĠĠĠ Ġ" some Very Long Identifier With Many Words " Ġto ĠlistOf (" some ", Ġ" very ", Ġ" long ", Ġ" identifier ", Ġ" with "), ĊĠĠĠĠĠ Ġ" short Identifier " Ġto ĠlistOf (" short ", Ġ" identifier ") ĊĠĠĠ Ġ) ĊĠĠĠ Ġcheck Results ( words Splitter , Ġnames 2 words ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` skip Ġshort Ġwords `() Ġ{ ĊĠĠĠ Ġval Ġwords Splitter Ġ= ĠWord s Splitter . Builder (). skip Short ( 3 ). toLowerCase (). build () ĊĠĠĠ Ġval Ġnames 2 words Ġ= Ġmap Of ( ĊĠĠĠĠĠ Ġ" my Identifier " Ġto ĠlistOf (" identifier "), ĊĠĠĠĠĠ Ġ" it _ is _ identifier " Ġto ĠlistOf (" identifier ") ĊĠĠĠ Ġ) ĊĠĠĠ Ġcheck Results ( words Splitter , Ġnames 2 words ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` use Ġstem ming `() Ġ{ ĊĠĠĠ Ġval Ġwords Splitter Ġ= ĠWord s Splitter . Builder (). with Stem ming (). toLowerCase (). build () ĊĠĠĠ Ġval Ġnames 2 words Ġ= Ġmap Of ( ĊĠĠĠĠĠ Ġ" reading Names " Ġto ĠlistOf (" read ", Ġ" name "), ĊĠĠĠĠĠ Ġ" lists _ of _ words " Ġto ĠlistOf (" list ", Ġ" of ", Ġ" word ") ĊĠĠĠ Ġ) ĊĠĠĠ Ġcheck Results ( words Splitter , Ġnames 2 words ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġcheck Results ( words Splitter : ĠWord s Splitter , Ġnames 2 words : ĠMap < String , ĠList < String >>) Ġ{ ĊĠĠĠ Ġfor Ġ(( name , Ġwords ) Ġin Ġnames 2 words . entries ) Ġ{ ĊĠĠĠĠĠ Ġval Ġresult Ġ= Ġwords Splitter . split ( name ) ĊĠĠĠĠĠ ĠassertEquals ( words , Ġresult ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ }