I am working on a document classifier which needs to classify document based on some keywords. The list of keywords and the category is provided as the configuration parameter. The document to be classified can be in any format so a conversion to plain texts needs to be made.

The classified document need to be shown as reports (DOCx, PDF, HTML, etc.)


Each section of the source text is represented by Paragraph which contains the text and paragraph number.

The classifier then takes the Paragraph and produces ClassifiedText which contains the text, words that match keywords and finally the list of categories.


The domain model right now just captures the relationships between different objects for eg: ClassifiedText contains one or more matching word and categories, there is no behaviour yet.

The main aim is to produce the reports which will be in different formats along with the JSON data which may be consumed by the APIs. The reports and JSON need to contains some important metrics like all the matching paragraphs for a given category, count of the total number of matched categories, etc.

Where should I put these queries? in the same domain model or create different service objects?

Is it a good design to have ClassifiedText model vs modifying the existing Paragraph model?

PS: This is a part of a larger problem I am solving and I planning to post small and focused questions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.