|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthultig.sumo.ChunkMark
hultig.sumo.Chunk
public class Chunk
This class represents a phrasal chunk from a sentence. A shallow parser divides a given sentence into a sequence of chunks, where each one is formed by a sequence of one or more words. For example, the following sentence:
The brown fox jumped over the fence.
has the following chunks:
[NP The/DT brown/JJ fox/NN] [VP jumped/VBD] [PP over/IN] [NP the/DT fence/NN] ./.
two noun phrases (NP
), one verb phrase (VP
), and one prepositional
phrase (PP
).
University of Beira Interior (UBI)
Centre For Human Language Technology and Bioinformatics (HULTIG)
Field Summary |
---|
Fields inherited from class hultig.sumo.ChunkMark |
---|
a, b, chtag |
Constructor Summary | |
---|---|
Chunk(ChunkedSentence cs,
ChunkMark cm)
This constructor requires a ChunkedSentence, which is a sentence marked with chunk positions through an array of ChunkMark objects. |
Method Summary | |
---|---|
double |
connection(Chunk cother)
This function computes the connection strength between two chunks, measured in terms of a numeric value. |
boolean |
contains(String cw)
Test if a tagged word occurs in this chunk. |
boolean |
eqaulPOS(Chunk cother)
Test if both chunks have the same POS tag. |
boolean |
equal(String sc)
Tests if this chunk word sequence is equal to a given string. |
Word |
get(int i)
Gives the word at a given position, from the chunk's sequence of words. |
String |
getPOS(int i)
Gives the word's part-of-speech, at a given position from this chunk word sequence. |
String |
getToken(int i)
Gives the token from this chunk at a given position. |
int |
index(String cw)
Gives the index of a tagged word, represented by a string, in this Chunk. |
static void |
main(String[] args)
The main method exemplifies the role of a chunk, in the context of a chunked sentence (obtained from shallow parsing), as well as the connection strength
method, for chunk comparison. |
int |
size()
Gives the number of words contained in this chunk. |
String |
toString()
Gives a string representation of this chunk, in the form of: POS[w1 w2 ... wn] , where POS is the chunk
part-of-speech tag and w1 ... wn the sequence of n
words forming this chunk. |
String |
toStringRegex()
Gives another string representation of this chunk, in the form of: <w1 w2 ... wn> : POS , where POS
is the chunk tag, and w1 ... wn are the sequence
of words in this chunk. |
Methods inherited from class hultig.sumo.ChunkMark |
---|
a, b, POS, posUndefined, set, set |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Chunk(ChunkedSentence cs, ChunkMark cm)
ChunkMark
array
defining the boundaries of each chunk. The constructor takes a
ChunkedSentence
and a ChunkMark
object to create an
instance of this class.
cs
- The chunked sentence.cm
- The chunk mark.Method Detail |
---|
public int size()
public Word get(int i)
i
- The position in the chunk.
public String getToken(int i)
i
- The word position, in the chunk word sequence.
public String getPOS(int i)
i
- The word position, in the chunk word sequence.
public double connection(Chunk cother)
cother
- The other chunk to compare with.
public boolean eqaulPOS(Chunk cother)
cother
- The chunk to compare with.
public boolean equal(String sc)
sc
- The string to compare to.
public int index(String cw)
cw
- The tagged word, for example: "addicted/VBN"
public boolean contains(String cw)
index
.
cw
- The tagged word, for example: "addicted/VBN"
true
value if contained, and false
otherwise.public String toString()
POS[w1 w2 ... wn]
, where POS
is the chunk
part-of-speech tag and w1 ... wn
the sequence of n
words forming this chunk.
toString
in class ChunkMark
public String toStringRegex()
<w1 w2 ... wn> : POS
, where POS
is the chunk tag, and w1 ... wn
are the sequence
of words in this chunk. The method was thought to
create regular expressions representing sentence reduction
rules. (JPC, 13 February, 2009)
public static void main(String[] args)
connection strength
method, for chunk comparison.
args
- No argument is expected.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |