Package: deep-disfluency
Deep Learning Driven Incremental Disfluency DetectionCode for Deep Learning driven incremental disfluency detection and related dialogue processing tasks.FunctionalityThe deep disfluency tagger consumes words (and optionally, POS tags and word timings) word-by-word and outputs xml-style tags for each disfluent word, symbolising each part of any repair or edit term detected. The tags are:<e/>- an edit term word, not necessarily inside a repair structure<rms id=“N”/>- reparandum start word for repair with ID number N<rm id=“N”/>- mid-reparandum word for repair N<i id=“N”/>- interregnum word for repair N<rps id=“N”/>- repair onset word for repair N (where N is normally the 0-indexed position in the sequence)<rp id=“N”/>- mid-repair word for repair N<rpn id=“N”/>- repair end word for substitution or repetition repair N<rpndel id=“N”/>- repair end word for a delete repair NEvery repair detected or in the gold standard will have at least therms,rpsandrpn/rpndeltags, but the others may not be present.Some example output on Switchboard utterances is as below, where<f/>is the default tag for a fluent word:4617:A:15:h		1	uh          	UH	    <e/>
    				2	i	        PRP	    <f/>
    				3	dont	    	VBPRB	    <f/>
    				4	know	    	VB	    <f/>

	4617:A:16:sd		1	the         	DT          <rms id="1"/>
    				2	the	        DT	    <rps id="1"/><rpn id="1"/>
    				3	things	    	NNS	    <f/>
    				4	they	    	PRP	    <f/>
    				5	asked	    	VBD         <f/>
    				6	to	        TO	    <f/>
    				7	talk	    	VB	    <f/>
    				8	about	    	IN          <f/>
    				9	were	    	VBD	    <f/>
    				10	whether	    	IN	    <rms id="12"/>
    				11	the	        DT	    <rm id="12"/>
    				12	uh	        UH	    <i id="12"/><e/>
    				13	whether	    	IN	    <rps id="12"/>
    				14	the	        DT	    <rpn id="12"/>
    				15	judge	    	NN	    <f/>
    				16	should	    	MD	    <f/>
    				17	be	        VB	    <f/>
    				18	the	        DT	    <f/>
    				19	one	        NN	    <f/>
    				20	that	    	WDT	    <f/>
    				21	does	    	VBZ	    <f/>
    				22	the	        DT	    <f/>
    				23	uh	        UH	    <e/>
				24	sentencing	NN	    <f/>Set up and basic useTo run the code here you need to havePython 2.7installed, and alsopipfor installing the dependencies.You need to run the below from the command line from inside this folder (depending on your user status, you may need to prefix the below withsudoor use a virtual environment):pip install -r requirements.txtIf you just want to use the tagger off-the-shelf see the usage indemo.pyor the notebookdemo.ipynb.
Make sure this repository is on your system path if you want to use it in python more generally.Use with live ASRIf you would like to run a live ASR version using the IBM Watson speech-to-text recognizer, you need to also do the following:InstallPortAudio- a free, cross-platform, open-source, audio I/O library. Install it first.Prepare your credentials from IBM Watson (free trials are available):Visit theIBM Watson projectspage.Choose your project.Copy the credentials tocredentials.jsoninto this directory.The ASR live streaming demo atasr_demo.pycan then be run and you should be able to see the recognized words, timings, POS tags, and disfluency tags appearing in real time as you speak into your microphone.Running experimentsThe code can be used to run the experiments on Recurrent Neural Networks (RNNs) and LSTMs from:Julian Hough and David Schlangen. Joint, Incremental Disfluency Detection and Utterance Segmentation from Speech. Proceedings of EACL 2017. Valencia, Spain, April 2017.Please citethe paperif you use this code.If you are using our pretrained models as in the usage indemo.pyyou can simply rundeep_disfluency/experiments/EACL_2017.py, ensuring the boolean variables at the top of the file to:download_raw_data=Falsecreate_disf_corpus=Falseextract_features=Falsetrain_models=Falsetest_models=TrueIf that level of reproducibility does not satisfy you, you can set all those boolean values toTrue(NB: be wary that training the models for each experiment in the script can take 24hrs+ even with a decent GPU).Once the script has been run, running the Ipython notebook atdeep_disfluency/experiments/analysis/EACL_2017/EACL_2017.ipynbshould process the outputs and give similar results to those recorded in the paper.AcknowledgmentsThis basis of these models is the disfluency and dialogue act annotated Switchboard corpus, based on that provided by Christopher Potts's 2011 Computational Pragmatics course ([[at http://compprag.christopherpotts.net/swda.html]]) or at [[https://github.com/cgpotts/swda]]. Here we use Julian Hough's fork which corrects some of the POS-tags and disfluency annotation:[[https://github.com/julianhough/swda.git]]The second basis is the word timings data for switchboard, which is a corrected version with word timing information to the Penn Treebank version of the MS alignments, which can be downloaded at:[[http://www.isip.piconepress.com/projects/switchboard/releases/ptree_word_alignments.tar.gz]]Extra: using the Switchboard audio dataIf you are satisfied just using lexical/POS/Dialogue Acts and word timing data alone, the above are sufficient, however if you want to use other acoustic data or generate ASR results from scratch, you must have access to the Switchboard corpus audio release. This is available for purchase from:[[https://catalog.ldc.upenn.edu/ldc97s62]]From the switchboard audio release, copy or move the folder which contains the .sph files (calledswbd1) to within thedeep_disfluency/data/raw_data/folder. Note this is very large at around 14GB.Future: Creating your own dataTraining data is created through creating dialogue matrices (one per speaker in each dialogue), whereby the format of these for each row in the matrix is as follows, where,indicates a new column, and...means there are potentially multiple columns:word index, pos index, word duration, acoustic features..., lm features..., labelThere are methods for creating these in thedeep_disfluency/corpusanddeep_disfluency/feature_extractionmodules.