File indexing completed on 2024-04-21 03:50:55
0001 /************************************************************************* 0002 * Copyright (C) 2020 by Caio Jordão Carvalho <caiojcarvalho@gmail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or * 0005 * modify it under the terms of the GNU General Public License as * 0006 * published by the Free Software Foundation; either version 3 of * 0007 * the License, or (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program. If not, see <http://www.gnu.org/licenses/>.* 0016 *************************************************************************/ 0017 0018 #ifndef SENTENCE_H 0019 #define SENTENCE_H 0020 0021 #include "core/markedclass.h" 0022 #include "core/markedobject.h" 0023 0024 /** Class that represent the annotated data resulted from text annotation. */ 0025 class Sentence : public MarkedObject 0026 { 0027 public: 0028 /** Create a Sentence. 0029 * @param objClass - MarkedClass's instance to assign. 0030 * @param begin - Location of the first letter of Sentence. 0031 * @param end - Location of the last letter of sentence. 0032 */ 0033 explicit Sentence(MarkedClass *objClass, quint64 begin = 0, quint64 end = 0); 0034 0035 void clear() override; 0036 QString unitName() const override; 0037 MarkedObject::Type type() override; 0038 0039 /** Verify if a sentence is valid (its begin is different and smaller than its end). */ 0040 bool isValid(); 0041 0042 /** Verify if a number is between the begin and end of a sentence. */ 0043 bool hasBetween(int number); 0044 0045 /** Move the position of a sentence. 0046 * @param anchor - new beggining of the sentence 0047 * @param end - new end of the sentence 0048 */ 0049 void move(double begin, double end); 0050 0051 /** @return the begin of the sentence. */ 0052 qreal begin() const; 0053 0054 /** @return the end of the sentence. */ 0055 qreal end() const; 0056 }; 0057 0058 #endif // SENTENCE_H