Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to implement a text classification system. It needs to read a text file, and extract the words and the word frequency. So far, I've been planning to parse the words, put them in a dictionary and save it to an XML file. I am using C++/CLI.

Is this a good implementation or is there a simpler or better implementation?

May be related question (some code implementation):

share|improve this question
My immediate reaction is that the general idea isn't very useful -- regenerating the data from the text is probably about as easy as parsing XML correctly. Other than that, I'm a bit uncertain why you'd mess with C++/CLI for it. If you want C++, using C++. If you want .NET, use C#. C++/CLI is one of those "neither fish nor fowl" things, that's better avoided unless truly required. – Jerry Coffin May 17 '12 at 17:54
Yeah, I am pretty much a very beginner users. About C++/CLI, I've only heard about it in halfway. But more on the question, don't I need the dictionary to make sure the words are not recorded twice? – Hearty May 17 '12 at 17:59

Yes, there may be better solutions but given your "beginner" status what is the target of better; you can optimize for speed, or for portability.

A binary data structure that could be randomly accessed would be faster, as XML is but a data exchange format; this of course makes it great for portability.

You will need a binary data structure anyway, while you are parsing out the words, until you are ready the write out the XML.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.