blob: b6003849ad8684bef1f173ae088f04590860316a [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package opennlp.tools.disambiguator.DatasetsReader;
import java.util.ArrayList;
public class IParagraph {
protected int pnum;
protected ArrayList<ISentence> isentences;
public IParagraph() {
super();
this.isentences = new ArrayList<ISentence>();
}
public IParagraph(int pnum) {
super();
this.pnum = pnum;
this.isentences = new ArrayList<ISentence>();
}
public IParagraph(int pnum, ArrayList<ISentence> sentences) {
super();
this.pnum = pnum;
this.isentences = sentences;
}
public int getPnum() {
return pnum;
}
public void setPnum(int pnum) {
this.pnum = pnum;
}
public ArrayList<ISentence> getSsentences() {
return isentences;
}
public void setIsentences(ArrayList<ISentence> isentences) {
this.isentences = isentences;
}
public void addIsentence(ISentence isentence) {
this.isentences.add(isentence);
}
@Override
public String toString() {
String paragraph = "";
for (int i = 0; i < this.isentences.size(); i++) {
paragraph = paragraph + " " + this.isentences.get(i).toString();
}
return paragraph.substring(1, paragraph.length());
}
/**
* This return TRUE only and only if the paragraph contains the word and it is
* sense-tagged
*
* @param wordTag
* @return {@value Boolean.true} if the word exists in the paragraph and is
* sense-tagged
*
*/
public boolean contains(String wordTag) {
for (ISentence isentence : this.getSsentences()) {
for (IWord iword : isentence.getIwords()) {
if (iword.equals(iword))
return true;
}
}
return false;
}
}