TextDocsComprLETTERS_SET, referenced from: _ZN12TextDocsCmprLETTER

  • Thread starter Jamin2112
  • Start date
In summary, the conversation discusses the use of a header file for a class called TextDocsCmpr. This class has various functions and a static variable called LETTERS_SET. The conversation also mentions an error that occurs when trying to initialize LETTERS_SET in the class constructor, and suggests initializing it outside the class definition.
  • #1
Jamin2112
986
12
“TextDocsCompr::LETTERS_SET”, referenced from: _ZN12TextDocsCmprLETTER

This is my header file:
Code:
#include <vector>  // std::vector
#include <string> // std::string
#include <fstream> // std::ifstream
#include <set> // std::set

class TextDocsCmpr { 

public: 

    TextDocsCmpr(); 
    ~TextDocsCmpr(); 
    void addFile(std::string); 
    void setThreshold(double); 

private:

    std::vector<std::string> files_vec; 
    std::vector<std::string> get_file_sntncs(std::fstream&);
    std::vector<std::string> get_sntnc_wrds(const std::string&);
    double sntnc_smlrty_qtnt(std::vector<std::string>, std::vector<std::string>);
    static std::set<char> LETTERS_SET;
    double sntnc_smlrty_thrshld; 


};

I initialize LETTERS_SET under the constructor in my cpp file:

Code:
TextDocsCmpr::TextDocsCmpr() { 
    // Set the sentence similarity threshold to a default of 0.7
    sntnc_smlrty_thrshld = 0.7;
    // Add all the characters of LETTERS_ARR to LETTERS_SET
    const char LETTERS_ARR[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
                                           'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
                                           'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 
                                           'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '\'', '.'}; 
    for (int i = 0; i < sizeof(LETTERS_ARR)/sizeof(char); ++i)
        LETTERS_SET.insert(LETTERS_ARR[i]);
}

But for some reason I get the following error:

"TextDocsCmpr::LETTERS_SET", referenced from: __ZN12TextDocsCmpr11LETTERS_SETE$non_lazy_ptr in PlagiarismDetector.o symbol(s) not found collect2: ld returned 1 exit status

I'm sorry for asking so many questions. Any help is greatly appreciated. You guys are the best!
 
Technology news on Phys.org

FAQ: TextDocsComprLETTERS_SET, referenced from: _ZN12TextDocsCmprLETTER

What is TextDocsComprLETTERS_SET?

TextDocsComprLETTERS_SET is a type of data structure used in the TextDocsCmprLETTER class. It is a set of unique letters that are used to compress text documents.

What is the purpose of using TextDocsComprLETTERS_SET?

The purpose of using TextDocsComprLETTERS_SET is to reduce the size of text documents by replacing commonly used letters with shorter codes. This helps to save storage space and improve efficiency when working with large amounts of text data.

How does TextDocsComprLETTERS_SET work?

TextDocsComprLETTERS_SET works by mapping each letter in a text document to a unique code. This code is then used to represent the letter in the compressed version of the document. When the compressed document is decompressed, the codes are converted back to letters, resulting in the original text document.

Can TextDocsComprLETTERS_SET be used for any language?

Yes, TextDocsComprLETTERS_SET can be used for any language as it is designed to work with any set of letters and codes. However, the effectiveness of compression may vary depending on the frequency and structure of letters in the language.

Are there any limitations to using TextDocsComprLETTERS_SET?

One limitation of TextDocsComprLETTERS_SET is that it may not be as effective for compressing documents with a large vocabulary or a wide range of characters. In addition, the compression may not be as significant for already highly compressed documents such as images or videos.

Similar threads

Replies
8
Views
2K
Replies
75
Views
5K
Replies
3
Views
2K
Replies
4
Views
4K
Replies
6
Views
2K
Replies
8
Views
6K
Replies
2
Views
430
Back
Top