Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.
/ satree Public archive
forked from woland84/satree

Javascript library that allows display of math formulas in Context MathML as trees for disambiguation

License

Notifications You must be signed in to change notification settings

tkw1536/satree

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Formula Tree Viewer

Description

Javascript library that allows display of math formulas in Context MathML as trees for disambiguation.

Build

To build from the sources you will need nodejs installed on your system. Please follow the instructions on the nodejs website to install it correctly

Then install the dependencies for the build system

[user@host]$cd ~/satree   #assuming satree the folder containing the code  
[user@host]$npm install  

Next run the build system

[user@host]$node build.js    #you can add --debug to build it for debug mode (i.e no comments stripped, code not minified)  

You should now have two files in the dist/ folder called satree.min.js and satree.min.css which are the minified versions of the src

Please note that dist/ already contains the built version of the library so there's no need to rebuild if you have not changed anything in the source

Deploy

To deploy the script all you have to do is include it alongside the css and start the manager on some HTMLElement. For example:

	<link href="../dist/satree.debug.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="../dist/satree.debug.js"></script>

    <script type="text/javascript">
        jQuery(document).ready(function(){
            var manager = new satree.Manager("body"); //This will mark any mathml elements under body
            manager.run();					
        });
	</script>

Configuration

You can configure several features of the library using the ConfigManager object. All configuration options are documented in the class file. You should usually set up your configuration before calling the run method of the Manager object, although you can always change them during runtime and refresh the Manager.

Server-side

The results of the disambiguation action are always sent to a server specified by the user using the POST HTTP method. The format is the following

  {
    "correct" : "Boolean" //true/false depending on the user's choice
    "id"      : "String"  //the id of the math element that was disambiguated
    "formula" : "String"  //the MathMl contents of the examined node
    "tree"    : "Json"    //the json representation of the tree built to represent the MathMl
  }

To set the url to which the result is sent use the ConfigManger e.g.:

  satree.ConfigManager.setSubmitUrl("http://host/contextPath");

There is a simple php script under src/php that you can use as an example.

Issues

Currently this library is being ported to JOBAD. Currently there are issues with jQuery UI / Bootstrap compatibility.

Live Example

You can find a live example here

Limitations

Currently the library is only working on Mozilla Firefox, the only browser with support for MathMl at the moment.
The sumarrization feature is highly dependent on correct xrefs to the MathMl tags from the annotation-xml elements, so make sure the ids are valid before testing.

Credits

This library uses the following third-party libraries:
Twitter Bootstrapt - Apache License
FlancheJs - MIT License
jQuery - MIT License
Underscorejs - MIT License
JIT SpaceTree - MIT License

About

Javascript library that allows display of math formulas in Context MathML as trees for disambiguation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%