blob: 830ccdf065cb94e4fc9d11245be13a1eb8cd4c14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/* vim: set expandtab tabstop=4 shiftwidth=4 : */
public class WordNet
{
// data type space linear in the input size
// constructor takes the name of the two input files
public WordNet(String synsets, String hypernyms)
{
// time linearithmic in the input size
// throw a java.lang.IllegalArgumentException
// if the input does not correspond to a rooted DAG
}
// the set of nouns (no duplicates), returned as an Iterable
public Iterable<String> nouns()
{
return null;
}
// is the word a WordNet noun?
public boolean isNoun(String word)
{
// run in time logarithmic in the number of nouns
return false;
}
// distance between nounA and nounB (defined below)
public int distance(String nounA, String nounB)
{
// run in time linear in the size of the WordNet digraph
// throw java.lang.IllegalArgumentException
// unless both of the noun arguments are WordNet nouns
return 0;
}
// a synset that is the common ancestor of nounA and nounB
// in a shortest ancestral path
public String sap(String nounA, String nounB)
{
// run in time linear in the size of the WordNet digraph
// throw java.lang.IllegalArgumentException
// unless both of the noun arguments are WordNet nouns
return "";
}
// for unit testing of this class
public static void main(String[] args)
{
}
}
|