| 1 |
/*************************************************************************/ |
| 2 |
/* */ |
| 3 |
/* Use of the link grammar parsing system is subject to the terms of the */ |
| 4 |
/* license set forth in the LICENSE file included with this software. */ |
| 5 |
/* This license allows free redistribution and use in source and binary */ |
| 6 |
/* forms, with or without modification, subject to certain conditions. */ |
| 7 |
/* */ |
| 8 |
/*************************************************************************/ |
| 9 |
|
| 10 |
package org.linkgrammar; |
| 11 |
|
| 12 |
import java.util.ArrayList; |
| 13 |
import java.util.Iterator; |
| 14 |
import java.util.List; |
| 15 |
|
| 16 |
/** |
| 17 |
* |
| 18 |
* <p> |
| 19 |
* Represents the result of parsing a piece of text. The result |
| 20 |
* consists of some global meta information about the whole parse |
| 21 |
* and a list of <code>Linkage</code>s returned by the parser. The |
| 22 |
* original parsed text is available as the <code>text</code> attribute. |
| 23 |
* </p> |
| 24 |
* |
| 25 |
* @author Borislav Iordanov |
| 26 |
* |
| 27 |
*/ |
| 28 |
public class ParseResult implements Iterable<Linkage> |
| 29 |
{ |
| 30 |
String parserVersion; |
| 31 |
String dictVersion; |
| 32 |
String text; |
| 33 |
List<Linkage> linkages = new ArrayList<Linkage>(); |
| 34 |
int numSkippedWords; |
| 35 |
|
| 36 |
public Iterator<Linkage> iterator() |
| 37 |
{ |
| 38 |
return linkages.iterator(); |
| 39 |
} |
| 40 |
|
| 41 |
public List<Linkage> getLinkages() |
| 42 |
{ |
| 43 |
return linkages; |
| 44 |
} |
| 45 |
|
| 46 |
public String getText() |
| 47 |
{ |
| 48 |
return text; |
| 49 |
} |
| 50 |
|
| 51 |
public void setText(String text) |
| 52 |
{ |
| 53 |
this.text = text; |
| 54 |
} |
| 55 |
|
| 56 |
public int getNumSkippedWords() |
| 57 |
{ |
| 58 |
return numSkippedWords; |
| 59 |
} |
| 60 |
|
| 61 |
public void setNumSkippedWords(int numSkippedWords) |
| 62 |
{ |
| 63 |
this.numSkippedWords = numSkippedWords; |
| 64 |
} |
| 65 |
|
| 66 |
public String getParserVersion() |
| 67 |
{ |
| 68 |
return parserVersion; |
| 69 |
} |
| 70 |
|
| 71 |
public void setParserVersion(String parserVersion) |
| 72 |
{ |
| 73 |
this.parserVersion = parserVersion; |
| 74 |
} |
| 75 |
|
| 76 |
public String getDictVersion() |
| 77 |
{ |
| 78 |
return dictVersion; |
| 79 |
} |
| 80 |
|
| 81 |
public void setDictVersion(String dictVersion) |
| 82 |
{ |
| 83 |
this.dictVersion = dictVersion; |
| 84 |
} |
| 85 |
} |