public class TokenPairUnaryCount extends TokenPairCount
Modifier and Type | Field and Description |
---|---|
long |
tok1count
count of token 1 pairs
|
long |
tok2count
count of token 2 pairs
|
isSingle, paircount
Constructor and Description |
---|
TokenPairUnaryCount()
Convenience
|
TokenPairUnaryCount(String tok1,
String tok2,
long paircount,
long tok1count,
long tok2count) |
TokenPairUnaryCount(TokenPairCount tpc,
long tok1count,
long tok2count)
same as
TokenPairUnaryCount(String, String, long, long, long) using the values from
the TokenPairCount instance |
Modifier and Type | Method and Description |
---|---|
double |
pmi(double n)
Calculate the Pointwise mutual information score such that:
PMI(x,y) = log( p(x,y) / ( p(x) p(y) ) )
where we can estimate the probabilities as:
p(x,y) = c(x,y) / n
p(x) = c(x) / n
p(y) = c(y) / n
where n is the total number of pairs observed
|
void |
readASCII(Scanner in)
Read internal state from in.
|
void |
readBinary(DataInput in)
Read internal state from in.
|
void |
writeASCII(PrintWriter out)
Write the content of this as ascii to out.
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
add, asciiHeader, binaryHeader, identifier, identifier, identifierBinary, parseTimeTokenID, timeFromBinaryIdentity, timeFromBinaryIdentity, toString
equals, firstObject, getFirst, getFirstFunction, getFirstObject, getSecond, getSecondFunction, getSecondObject, pair, pairList, secondObject, setFirstObject, setSecondObject, swap, swapList
public long tok1count
public long tok2count
public TokenPairUnaryCount()
public TokenPairUnaryCount(String tok1, String tok2, long paircount, long tok1count, long tok2count)
tok1
- the first token (x)tok2
- the second token (y)paircount
- the count of the tokens together (c(x,y))tok1count
- the count of the first token with any other token (c(x))tok2count
- the count of the second token with any other token (c(y))public TokenPairUnaryCount(TokenPairCount tpc, long tok1count, long tok2count)
TokenPairUnaryCount(String, String, long, long, long)
using the values from
the TokenPairCount
instancetpc
- tok1count
- tok2count
- public void writeBinary(DataOutput out) throws IOException
WriteableBinary
writeBinary
in interface WriteableBinary
writeBinary
in class TokenPairCount
out
- sink to write toIOException
- an error writing to outpublic void readBinary(DataInput in) throws IOException
ReadableBinary
readBinary
in interface ReadableBinary
readBinary
in class TokenPairCount
in
- source to read from.IOException
- an error reading inputpublic void writeASCII(PrintWriter out) throws IOException
WriteableASCII
writeASCII
in interface WriteableASCII
writeASCII
in class TokenPairCount
out
- sink to write toIOException
- an error writing to outpublic void readASCII(Scanner in) throws IOException
ReadableASCII
readASCII
in interface ReadableASCII
readASCII
in class TokenPairCount
in
- source to read from.IOException
- an error reading inputpublic double pmi(double n)
n
- the total number of pairs observed