Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you need to consider, is whether, in your problem domain, an AnalyzedSentence and FinalSentence are unique enough to be split or merged.</p> <p>It's clear they're working with similar data and cooperating closely in order to achieve the goal.</p> <p>To me, analysed and final are just states that a Sentence could be in, although that is based on my limited knowledge of the problem you're working on, so I would look to combine them in some way.</p> <p><strong>Edit</strong> Based on the further information, I think I would design it something like this:</p> <p>The <code>Sentence</code> class encapsulates the original sentence, the tags, and the extracted category (or whatever it is you're extracting, I'm assuming it's a category based on your description), and the operations to set, get, and extract that information.</p> <p>The <code>Sentence</code> class stores a <code>TagList</code> that contains all the tags, the original string, and the extracted category. It also encapsulates the extraction of the data by creating an <code>Extractor</code> and passing it the <code>TagList</code> when the data needs extraction (I've put it in the constructor, but it could go in a method, where it gets called depends on when you need to extract the data).</p> <p>So in this way, everything required to manipulate the original sentence is in the <code>Sentence</code> class. Of course, you may know something that I don't that makes this approach unsuitable, but here's some code to illustrate what I mean:</p> <pre><code>public class Sentence { private TagList tags private String category; private String sentence public Sentence(String newSentence) { sentence = newSentence; Extractor&lt;TagList&gt; e = new Extractor&lt;TagList&gt;() tags = e.extractTags(sentence); category = new Category(tags); } public String getXYZ() { } public void setXYZ(...) {...} private extractTags(String s){ ...} // getters, setters } public class TagList{ private List&lt;String&gt; tags; .... //rest of class definition } </code></pre>
    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. 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.
    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