opencog/link-grammar — pull request #29 by ampli (2014-12-14 14:31:50+00:00)
Title: Avoid an infinite loop in the right-strip loop.

At the end of the loop, if the remaining word is not in the dict, the loop doesn't terminate.
So terminate it if the same remaining word is seen again.
It will eventually be handled as an unknown word.

Repeat by:
link-parser he
linkparser> !v=2
verbosity set to 2
linkparser> **.**
1: strip_right(RPUNC): w='.' rword '.'
1: strip_right(RPUNC): return TRUE; n_r_stripped=0+0, wend='' temp_wend=''
2: strip_right(RPUNC): w='.' rword '.'
2: strip_right(RPUNC): return TRUE; n_r_stripped=0+0, wend='' temp_wend=''
3: strip_right(UNITS): return FALSE; root='.' (. is not a digit)
4: strip_right(RPUNC): w='.' rword '.'
4: strip_right(RPUNC): return TRUE; n_r_stripped=0+0, wend='' temp_wend=''
2: strip_right(RPUNC): w='.' rword '.'
2: strip_right(RPUNC): return TRUE; n_r_stripped=0+0, wend='' temp_wend=''
...