1 / 18

Implementing FastTBL in Oz

Leif Grönqvist (lgr@msi.vxu.se) & Fredrik Kronlid (kronlid@ling.gu.se). Implementing FastTBL in Oz. TBL. The training phase Input: Annotated corpus Rule templates Output: Sequence of rules (“best” rule first) Annotation phase Input: Sequence of rules Un-annotated corpus

odetta
Download Presentation

Implementing FastTBL in Oz

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Leif Grönqvist (lgr@msi.vxu.se) & Fredrik Kronlid (kronlid@ling.gu.se) Implementing FastTBL in Oz

  2. TBL The training phase • Input: • Annotated corpus • Rule templates • Output: • Sequence of rules (“best” rule first) Annotation phase • Input: • Sequence of rules • Un-annotated corpus • Lexicon for initial annotations • Output • Annotated corpus

  3. Vanilla TBL (VTBL) • Rules are selected greedy • Corpus annotations updated after each rule selected • Continue until enough rules or no errors left • Number of possible rules in each iteration is very high • Grows by tagset, number of templates, and number of variables in templates • No results used from earlier iterations

  4. TBL à la Ramshaw & Marcus • Only applicable rules, correcting at least one sample is generated • The set of rules are saved between iterations • For each rule there is: • a score • a list of affected positions in the corpus • For all samples there is a list of applicable rules • Much faster than vanilla TBL • Needs much more memory than VTBL • The update of the needed structures takes a large amount of the time used during training

  5. FastTBL • Ngai, G. & Florian, R. (2001), Transformation-Based Learning in the Fast Lane, in ‘Proceedings of the 39th ACL Conference’. • Similar to Ramshaw & Marcus: • Only applicable rules, correcting at least one sample is generated • The set of rules are saved between iterations • For each rule there is: • a score consisting of the “Good” and “Bad” part • For each selected rule, the scores for all rules are updated • The “vicinity” of a sample tells the system which samples the classification may depend on • Much faster than Ramshaw & Marcus • Needs much less memory than R & M

  6. The algorithm in a nutshell

  7. Ngai & Florian’s description • Unclear what to store and how • When should chosen rules be applied to the corpus? • Notations like b(s) and p(b(s)) seem a bit sloppy – what do they mean? • b: rule, p: predicate, s: sample • How do we define vicinity? • An algorithm description should describe the algorithm

  8. Implementation • Oz • Data structures • Programming paradigms

  9. Oz • A multi-paradigm language • Object-oriented • Functional • Concurrent • Distributed • Declarative • Stateful • ....

  10. Data & Paradigm • We use functional programming, logic programming and imperative programming techniques. • Functional programming – some higher order functions • Extensive use of tuples – logic programming • Corpus – Array, Rule collection – Dictionary: stateful structures, assignment works

  11. Corpus representation • Many ways to access data in Oz • Data from μ-TBL (SUC) • Solution: • (Script to transform SUC to μ-TBL format) • Perl script for transforming SUC data into a tuple in a functor (Oz module) • Tuple converted to Array for mutability

  12. Template representation μ-TBL template representation allows • Constraints on any feature • Conjunction of constraints • Disjunction of positions • Target can change any feature tag:A>B <- wd:C@[0] & tag:D@[-1,-2] Requires an elaborate template compiler

  13. Templates cont’d FoztTBL templates allow • Constraints on tags and words • Conjunction of constraints • The only target is ”change tag A into B” • Our template format also give the possibility to generate rules on the form “change any tag to B”

  14. Templates cont’d We use an extremely simple template formalism: template(wd(0 0 c 0 0) tag(0 0 a d 0)) tag:A>B <- wd:C@[0] & tag:A@[0] & tag:D@[1] A FoztTBL template is instantiated into a Predicate by pattern matching

  15. Representing the rules • Rule: predicate and target + additional info • Tuple of tuples • rule(P T F UsedFlag) • P = predicate( wd(EMPTY EMPTY om EMPTY EMPTY) tag(EMPTY EMPTY pp EMPTY EMPTY) ) • T = target(sn) • F = f(Good, Bad) • UsedFlag – a flag to indicate whether the rule has been applied or not (tag:pp>sn <- wd:om@[0] & tag:pp@[0])

  16. Representing the rule collection • FastTBL requirement: instant (constant time) access to all rules with a certain predicate • Oz Dictionaries – hash tables with atoms as keys • Solution: • Dictionary • functions for rapid conversion predicate-atom

  17. Conclusions • FastTBL has: • Better time complexity than VTBL and RMTBL • Uses less memory than VTBL • Gives the same result • The multiparadigmatic nature of Oz makes programming easier • An algorithm appearing in a reviewed paper isn't necessarily complete, comprehensible or easily implementable.

  18. Future Work • Understand the algorithm in detail • Read the C++ code • Use the ideas in Ngai/Florian and reinvent it • Implement and read Ngai/Florian iteratively using a debugger • Finish off the implementation • Improve on the clarity of the implementation and the algorithm description • Make the template formalism more flexible, keeping its simplicity

More Related