Example 1: A simple context-free example

The parser can be used by running:
java -jar stefs.jar
(or: java -classpath stefs.jar stefs.Interpreter).

Input:

// -- `//' denotes comment
//
// Let us take a sentence:
//   Bill thought Hillary left yesterday. (Johnson 99)
//
// We want to obtain the following two parses:
//
// (S1 (S (NP (N Bill))
//        (VP (V thought)
//            (S (NP (N Hillary))
//               (VP (V left))
//               (AD yesterday))))
//     (. .) )
//
// (S1 (S (NP (N Bill))
//        (VP (V thought)
//            (S (NP (N Hillary))
//               (VP (V left))))
//        (AD yesterday))
//     (. .) )

[N] -> Bill .
[V] -> thought .
[N] -> Hillary .
[V] -> left .
[AD] -> yesterday .
['.'] -> '.' .

[NP] -> [N] .
[VP] -> [V] .
[S] -> [NP] [VP] .
[S] -> [NP] [VP] [AD] .
[VP] -> [V] [S] .
[S1] -> [S] ['.'] .

tokenize <s> Bill thought Hillary left yesterday. </s>

parse
print parse trees

Output:

2 successful parses
parsing time:0.0090 seconds
(S1 (S (NP (N Bill)) (VP (V thought) (S (NP (N Hillary)) (VP (V left)) (AD yesterday)))) (. .))
(S1 (S (NP (N Bill)) (VP (V thought) (S (NP (N Hillary)) (VP (V left)))) (AD yesterday)) (. .))


© 2000-2007 Vlado Keselj, last update: March 27, 2007.