Skip to content

cth/sdcg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stochastic Definite Clause Grammars

SDCG is a compiler which compiles from an extended version of Prologs DCG syntax to a stochastic program expressed using the amazing PRISM system.

It is intended to be used for natural language parsing which requires something a bit more expressive than stochastic context-free grammars.

Sample run

The Prism system should be installed first. Prism uses B-Prolog. (This code does not run on SWI-Prolog.) Then run prism, and load grammar files, e.g.

% cd grammars/report_simple
% prism
PRISM 2.2, (C) Sato Lab, Tokyo Institute of Technology, September, 2015
B-Prolog Version 7.8b1, All rights reserved, (C) Afany Software 1994-2012.

This edition of B-Prolog is for evaluation, learning, and non-profit
research purposes only, and a license is needed for any other uses.
Please visit http://www.probp.com/license.htm for the detail.

Type 'prism_help' for usage.
| ?- [load].
...
| ?- train_with_parsetree.
train_with_parsetree.
#goals: 0(4)
Exporting switch information to the EM routine ... done
#em-iters: 0(9) (Converged: -9.773285894)
Statistics on learning:
        Graph size: 63
        Number of switches: 5
        Number of switch instances: 11
        Number of iterations: 9
        Final log likelihood: -9.773285894
        Total learning time: 0.003 seconds
        Explanation search time: 0.000 seconds
        Total table space used: 25784 bytes
Type show_sw to show the probability distributions.
Switch n(1): unfixed_p: n_1_2 (p: 0.400000540) n_1_1 (p: 0.599999460)
Switch np(1): unfixed_p: np_1_2 (p: 0.749998876) np_1_1 (p: 0.250001124)
Switch s(1): unfixed_p: s_1_2 (p: 0.999998876) s_1_1 (p: 0.000001124)
Switch v(1): unfixed_p: v_1_3 (p: 0.500000562) v_1_2 (p: 0.250000281) v_1_1 (p: 0.249999157)
Switch vp(1): unfixed_p: vp_1_2 (p: 1.000000000) vp_1_1 (p: 0.000000000)

yes
| ?- testit.
testit.
time_flies-0.112497
time_time-3.84627e-07

yes
| ?- 

Files

  • compiler/
    • Contains the code of the SDCG compiler
  • util/
    • Contains various utilities of used by the compiler
  • test/
    • Contains unit-tests for the compiler
  • misc/
    • Various stuff
  • grammars/
    • Some example grammars

About

Stochastic Definite Clause Grammars

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages