doc1:I really liked my small dogs, and I think my mom also liked them.
doc2:He never liked any dog, so I hope that my mom will not expect me to like him.
分词,初步的倒排索引的建立
| word | doc1 | doc2 | normalization |
|---|---|---|---|
| I | * | * | |
| really | * | ||
| liked | * | * | likes,liked |
| my | * | * | |
| small | * | little | |
| dogs | * | dog,DOG | |
| and | * | ||
| think | * | ||
| mom | * | * | mother |
| also | * | ||
| them | * | ||
| He | * | ||
| never | * | ||
| any | * | ||
| dog | * | ||
| so | * | ||
| hope | * | ||
| that | * | ||
| will | * | ||
| not | * | ||
| expect | * | ||
| me | * | ||
| to | * | ||
| like | * | ||
| him | * |
这个时候去搜索mother likes little DOG,会拆分成4个词,查找无结果,这并不是我们想要的搜索结果。因为在我们看来,mother和mum是同义词,likes和like是不同时态的同一个词。
所以在建立索引的时候,会执行normalization,也就是说对拆分出的各个单词进行相应的处理,以提升后面搜索的时候能够搜索到相关文档的概率。
重新建立倒排索引,再次检索,不仅会拆分,同样会进行normalization,就可以检索出结果为doc1和doc2。
