Package: sciwing
A Modern Toolkit for Scientific Document Processing fromWING-NUS. You can find our technical report  here:https://arxiv.org/abs/2004.03807.NoteThe previous demo was available atbit.ly/sciwing-demo. Due to unavoidable circumstances, it has been moved torebrand.ly/sciwing-demo.SciWING is a modern framework from WING-NUS to facilitate Scientific Document Processing.  It is built on PyTorch and believes in modularity from ground up and easy to use interface. SciWING includes many pre-trained models for fundamental tasks in Scientific Document Processing for practitioners. It has the following advantages:Modularity- The framework embraces modularity from ground-up.SciWINGhelps in creating new models by combining multiple re-usable modules. You can combine different modules and experiment with new approaches in an easy mannerPre-trained Models- SciWING has many pre-trained models for fundamental tasks like Logical Section Classifier for scientific documents, Citation string Parsing (Take a look at some of the other project related to station parsingParscit,Neural Parscit. Easy access to pre-trained models are made available through web APIs.Run from Config File- SciWING enables you to declare datasets, models and experiment hyper-params in aTOMLfile. The models declared in a TOML file have a one-one correspondence with their respective class declaration in a python file. SciWING parses the model to a Directed Acyclic Graph and instantiates the model using the DAG's topological ordering.Extensible- SciWING enables easy addition of new datasets and provides command line tools for it. It enables addition of custom modules which are PyTorch modules.InstallationYou can install SciWING from pip. We recommend using a virtual environment to install the package.pipinstallsciwing# install spacy language packpython-mspacydownloaden_core_web_smTasksThese are some of the tasks included in SciWING and their performance metricsTaskDatasetSciWING modelSciWINGPrevious BestLogical Structure RecoverySectLabelBiLSTM + Elmo Embeddings73.2 (Macro F-score)-Header NormalisationSectLabelBag of Words Elmo93.52 (Macro F-Score)-Citation String ParsingNeural ParscitBi-LSTM-CRF + GloVe + Elmo + Char-LSTM88.44 (Macro F-Score)90.45Prasad et al(not comparable)Citation Intent ClassificationSciCiteBi-LSTM + Elmo82.16 (Fscore)82.6Cohan et al(without multi-task learning)I2b2 NERI2B2Bi-LSTM + Elmo85.83 (Macro FScore)86.23Boukkouri et alBC5CDR - NER (Upcoming)----Simple ExampleUsing Citation String Parsingfromsciwing.models.neural_parscitimportNeuralParscit# instantiate an objectneural_parscit=NeuralParscit()# predict on a citationneural_parscit.predict_for_text("Calzolari, N. (1982) Towards the organization of lexical definitions on a database structure. In E. Hajicova (Ed.), COLING '82 Abstracts, Charles University, Prague, pp.61-64.")# if you have a file of citations with one citation per lineneural_parscit.predict_for_file("/path/to/filename")Here is the output of the above example:Using Citation Intent Classificationfromsciwing.models.citation_intent_clfimportCitationIntentClassification# instantiate an objectcitation_intent_clf=CitationIntentClassification()# predict the intention of the citationcitation_intent_clf.predict_for_text("Abu-Jbara et al. (2013) relied on lexical,structural, and syntactic features and a linear SVMfor classification.")Running API servicesThe APIs are built usingFast API. We have APIs for citation string parsing, citation intent classification and many other models. There are more APIs on the way. To run the APIs navigate into theapifolder of this repository and runuvicornapi:app--reloadRunning the DemosThe demos are built usingStreamlit. The Demos make use of the APIs. Please make sure that the APIs are running before the demos can be started. Navigate to the app folder and run the demo using streamlit (Installed along with the package). For example, this command runs all the demos.Note:The demos download the models and the embeddings if already not downloaded and running the first time on your local machine might take time and memory. We have tested this on a 16GB MacBook Pro and works well. All the demos run on CPU for now and does not make use of any GPU, even when present.streamlitrunall_apps.pyContributingThank you for your interest in contributing. You can directly email the author at (email omitted for submission purposes). We will be happy to help.If you want to get involved in the development we recommend that you install SciWING on a local machine using the instructions below. All our classes and methods are documented and hope you can find your way around it.Instructions to install SciWING locallySciWING requires Python 3.7, We recommend that you installpyenv.Instructions to install pyenv are availablehere. If you have problems installing python 3.7 on your machine, make sure to check out their common build problems sitehereand install all dependencies.Clone from gitgit clone https://github.com/abhinavkashyap/sciwing.gitcd sciwingInstall all the requirementspip install -r requirements.txtDownload spacy modelspython -m spacy download enInstall the package locallypip install -e .Create directories where sciwing stores embeddings and experiment resultssciwing develop makedirssciwing develop downloadThis will take some time to download all the data and embeddings required for developmentSip some :coffee:. Come back laterRun TestsSciWING usespytestfor testing. You can use the following command to run testspytest tests -n auto --dist=loadfileThe test suite is huge and again, it will take some time to run. We will put efforts to reduce the test time in the next iterations.