Need to organize words based on their components, any other way aside from brute force?

Posted by Lathan on Programmers See other posts from Programmers or by Lathan
Published on 2014-08-21T17:39:53Z Indexed on 2014/08/21 22:26 UTC
Read the original article Hit count: 152

I'm not sure if this process has a name.

I have some words (about 9,000). They are in Japanese, but I'll try to explain this using English words. I want to categorize the words by the components (in English, letters).

A

B

C

act bar play

This should create:

A: play

B: bar

C: act

Now, 'a' appears in all 3 words, but I want to make sure that each category (letter) has at least word. Now, it would make sense to delete a word after it's used, but there are a few cases where 2 letters make up one word and that's each letter's only word--so I'd like to account for that somehow.

Is there an approach for solving this aside from brute force? Dynamic programming perhaps? Even a name for this process (if it exists) would be great.

© Programmers or respective owner

Related posts about java

Related posts about algorithms