Class TextConverter

java.lang.Object
de.fau.cs.osr.utils.visitor.VisitorInterface<T>
de.fau.cs.osr.utils.visitor.VisitorBase<T>
de.fau.cs.osr.ptk.common.AstVisitor
org.languagetool.dev.wikipedia.TextConverter

public class TextConverter extends de.fau.cs.osr.ptk.common.AstVisitor
A visitor to convert an article AST into a pure text representation. To better understand the visitor pattern as implemented by the Visitor class, please take a look at the following resources:
  • http://en.wikipedia.org/wiki/Visitor_pattern (classic pattern)
  • http://www.javaworld.com/javaworld/javatips/jw-javatip98.html (the version we use here)
The methods needed to descend into an AST and visit the children of a given node n are
  • dispatch(n) - visit node n,
  • iterate(n) - visit the children of node n,
  • map(n) - visit the children of node n and gather the return values of the visit() calls in a list,
  • mapInPlace(n) - visit the children of node n and replace each child node c with the return value of the call to visit(c).
  • Field Summary

    Fields inherited from class de.fau.cs.osr.ptk.common.AstVisitor

    REMOVE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    enableMapping(boolean enableMapping)
     
    Map<Integer,xtc.tree.Location>
    Return a mapping from converted text positions to original text positions.

    Methods inherited from class de.fau.cs.osr.ptk.common.AstVisitor

    dispatch, iterate, map, mapInPlace

    Methods inherited from class de.fau.cs.osr.utils.visitor.VisitorBase

    after, before, go, handleVisitingException, resolveAndVisit, visitNotFound

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TextConverter

      public TextConverter()
  • Method Details

    • enableMapping

      public void enableMapping(boolean enableMapping)
    • getMapping

      public Map<Integer,xtc.tree.Location> getMapping()
      Return a mapping from converted text positions to original text positions.