Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try a stochastic regular grammar (equivalent to hidden markov models) with the following rules:</p> <pre><code>for every word in a dictionary: stream -&gt; word_i stream with probability p_w word_i -&gt; letter_i1 ...letter_in` with probability q_w (this is the spelling of word_i) stream -&gt; letter stream with prob p (for any letter) stream -&gt; epsilon with prob 1 </code></pre> <p>The probabilities could be derived from a training set, but see the following discussion. The most likely parse is computed using the Viterbi algorithm, which has quadratic time complexity in the number of hidden states, in this case your vocabulary, so you could run into speed issues with large vocabularies. But what if you set all the p_w = 1, q_w = 1 p = .5 Which means, these are probabilities in an artificial language model where all words are equally likely and all non-words are equally unlikely. Of course you could segment better if you didn't use this simplification, but the algorithm complexity goes down by quite a bit. If you look at the recurrence relation in the <a href="http://en.wikipedia.org/wiki/Viterbi_algorithm" rel="nofollow">wikipedia entry</a> you can try and simplify it for this special case. The viterbi parse probability up to position k can be simplified to <code>VP(k) = max_l(VP(k-l) * (1 if text[k-l:k] is a word else .5^l)</code> You can bound l with the maximim length of a word and find if a l letters form a word with a hash search. The complexity of this is independent of the vocabulary size and is <code>O(&lt;text length&gt; &lt;max l&gt;)</code>. Sorry this is not a proof, just a sketch but should get you going. Another potential optimization, if you create a trie of the dictionary, you can check if a substring is a prefix of any correct word. So when you query text[k-l:k] and get a negative answer, you already know that the same is true for text[k-l:k+d] for any d. To take advantage of this you would have to rearrange the recursion significantly, so I am not sure this can be fully exploited (it can see comment).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload