This assignment is to write a C++ for natural language processing. General notes 1. Your assignment should be carefully
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
This assignment is to write a C++ for natural language processing. General notes 1. Your assignment should be carefully
Paragraph This class should be used to store characters (you can simply this as a single string). The following methods should also be provided. constructor: this Paragraph class should have a parametric constructor, while the input argument is len. That is, this constructor will produce a random string with the length of len. This string should be a mix of characters (both digital numbers and single letters), and it will be considered as the context of this Paragraph instance; • destructor: this Paragraph class should have a destructor; • display: this method should display the context of one Paragraph instance; • difference: this method should take another Paragraph instance to compare. The result is the element-wise difference from two paragraphs. For instance, the difference between paragraphs of abcde and abgze is 2: abcde (vs) abgze result: 00110 => 0 and 1 represents the same and different characters, respectively Document This class should be used to store collections of Paragraph instances. The following methods should be provided. • display: this method should display the context of all Paragraph instances; • minDifference: this method should determine the minimum difference across all Paragraph in- stances within this Document; • characterStatistics: this method should determine the minimal and maximal count of characters across all Paragraph instances within this Document;
Example ./main 3 10 As num = 3 and len = 10, so you should generate context for 3 paragraphs. Each paragraph has 10 characters. The display function is used to print out contexts for all paragraphs (again, the context should be generated randomly): PM696PpV39 ZsDzdeQ7mR 10W95W79ZN => this is for the 1st paragraph => this is for the 2nd paragraph => this is for the 3rd paragraph 2 For 1st and 2nd paragraph, we have: PM696PpV39 (vs) ZsDzdeQ7mR => 1111111111 => 10 for 1st and 3rd paragraph, we have: PM696PpV39 (vs) 10W95w79ZN => 1110111111 => 9
for 2nd and 3rd paragraph, we have: ZsDzdeQ7mR (vs) 10W95w79ZN 1111111111 => 10 As such, we have minDifference = min(10,9,10) = 9; For characterStatistics, the output should be like: min count as characters vs counts: R 1 z 1 w 1 s1 pl m 1 11 e 1 d 1 W 1 V 1 01 Q1 N 1 M 1 D 1 51 31 max count as characters vs counts: 94