"Fossies" - the Fresh Open Source Software Archive

Member "cb2bib-2.0.1/src/c2b/collectionAnalyzer.h" (12 Feb 2021, 2633 Bytes) of package /linux/privat/cb2bib-2.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "collectionAnalyzer.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.0.0_vs_2.0.1.

    1 /***************************************************************************
    2  *   Copyright (C) 2004-2021 by Pere Constans
    3  *   constans@molspaces.com
    4  *   cb2Bib version 2.0.1. Licensed under the GNU GPL version 3.
    5  *   See the LICENSE file that comes with this distribution.
    6  ***************************************************************************/
    7 #ifndef COLLECTIONANALYZER_H
    8 #define COLLECTIONANALYZER_H
    9 
   10 #include <QStringList>
   11 #include <QVarLengthArray>
   12 
   13 
   14 class settings;
   15 
   16 
   17 class collectionAnalyzer
   18 {
   19 
   20 public:
   21     collectionAnalyzer();
   22     inline ~collectionAnalyzer() {}
   23 
   24     void reload();
   25     void setDocumentKeywords(const QString& documentfn);
   26     void setKeywordDocuments(const QString& keyword);
   27     void setSimilarDocuments(const QString& documentfn);
   28     void skipSimilarDocument(const int i);
   29 
   30     inline int similarCount() const
   31     {
   32         return _nsimilar;
   33     }
   34     inline const QString& similar(const int i) const
   35     {
   36         return _documents[_similar[i]];
   37     }
   38     inline const QVarLengthArray<double>& similarity() const
   39     {
   40         return _similarity;
   41     }
   42     inline double similarity(const int i) const
   43     {
   44         return _similarity[i];
   45     }
   46     inline int sentenceCount() const
   47     {
   48         return _sentences.size();
   49     }
   50     inline const QString& sentence(const int i) const
   51     {
   52         return _sentences[i];
   53     }
   54     inline int keywordCount() const
   55     {
   56         return _document_keyword_ids.size();
   57     }
   58     inline int keywordid(const int i) const
   59     {
   60         return _document_keyword_ids.at(i);
   61     }
   62     inline int documentCount() const
   63     {
   64         return _sdocuments.size();
   65     }
   66     inline const QString& document(const int i) const
   67     {
   68         return _documents[_sdocuments[i]];
   69     }
   70 
   71 
   72 private:
   73     int _document_id(const QString& documentfn) const;
   74     int _sentence_id(const QString& keyword) const;
   75     void grepDocuments(const QString& documentfn, QVector<int>* dsentences) const;
   76     void grepSentences(const QString& keyword, QVarLengthArray<int>* sdocuments) const;
   77 
   78     QList<int> _document_keyword_ids;
   79     QString _document_keyword;
   80     QString _documentsif_fn;
   81     QString _documentslf_fn;
   82     QString _keyword_document_fn;
   83     QString _sentencesif_fn;
   84     QString _sentenceslf_fn;
   85     QString _similar_document_fn;
   86     QVarLengthArray<QString> _documents;
   87     QVarLengthArray<QString> _sentences;
   88     QVarLengthArray<double> _similarity;
   89     QVarLengthArray<int> _sdocuments;
   90     QVarLengthArray<int> _similar;
   91     QVarLengthArray<ushort> _document_norms;
   92 
   93     int _ndocuments;
   94     int _nsentences;
   95     int _nsimilar;
   96     settings* _settingsP;
   97 };
   98 
   99 #endif