开发者

Deducing string transformation rules

开发者 https://www.devze.com 2023-04-08 17:18 出处:网络
I have a set of pairs of character strings, e.g.: abba - aba, haha - aha, baa - ba, exb - esp, xa - za The second (right) string in the pair is somewhat similar to the first (left) string.

I have a set of pairs of character strings, e.g.:

abba - aba, haha - aha, baa - ba, exb - esp, xa - za

The second (right) string in the pair is somewhat similar to the first (left) string.

That is, a character from the first string can be represented by nothing, itself or a character from a small set of characters.

There's no simple rule for this character-to-character mapp开发者_开发问答ing, although there are some patterns.

Given several thousands of such string pairs, how do I deduce the transformation rules such that if I apply them to the left strings, I get the right strings?

The solution can be approximate, working correctly for, say, 80-95% of the strings.

Would you recommend to use some kind of a genetic algorithm? If so, how?


If you could align the characters, or rather groups of characters, you could work out tables saying that aa => a, bb => z, and so on. If you had such tables, you could align the characters using http://en.wikipedia.org/wiki/Dynamic_time_warping. One approach is therefore to guess an alignment (e.g. one for one, just as a starting point, or just align the first and last characters of each sequence), work out a translation table from that, use DTW to get a new alignment, work out a revised translation table, and iterate in that way. Perhaps you could wrap this up with enough maths to show that there is some measure of optimality or probability that such passes increase, climbing to a local maximum.

There is probably some way of doing this by modelling a Hidden Markov Model that generates both sequences simultaneously and then deriving rules from that model, but I would not chose this approach unless I was already familiar with HMMs and had software to use as a starting point that I was happy to modify.


You can use text to speech to create sound waves. then compare sound waves with other's and match them with percentages.

This is my theory how Google has such a advanced spell checker.

0

精彩评论

暂无评论...
验证码 换一张
取 消