Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	typings for mentions and pair features
Browse files- js-src/coref.ts +59 -0
    	
        js-src/coref.ts
    CHANGED
    
    | @@ -14,6 +14,62 @@ declare interface Coreference { | |
| 14 | 
             
            	resolved: string;
         | 
| 15 | 
             
            }
         | 
| 16 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 17 | 
             
            declare interface Response {
         | 
| 18 | 
             
            	cleanedText: string;
         | 
| 19 | 
             
            	corefResText: string;
         | 
| @@ -24,6 +80,8 @@ declare interface Response { | |
| 24 | 
             
            	                                                             /// Single scores are to be compared to the set of pairScores (for the same mention).
         | 
| 25 | 
             
            	                                                             /// If it's higher than every pair score, it's a single mention.
         | 
| 26 | 
             
            	cleanedContext: string;                                      /// Cleaned version of the context.
         | 
|  | |
|  | |
| 27 | 
             
            	isResolved: boolean;
         | 
| 28 | 
             
            }
         | 
| 29 |  | 
| @@ -62,6 +120,7 @@ class Coref { | |
| 62 | 
             
            			if (request.status >= 200 && request.status < 400) {
         | 
| 63 | 
             
            				this.onSuccess();
         | 
| 64 | 
             
            				const res: Response = JSON.parse(request.responseText);
         | 
|  | |
| 65 | 
             
            				this.render(res);
         | 
| 66 | 
             
            			}
         | 
| 67 | 
             
            			else {
         | 
|  | |
| 14 | 
             
            	resolved: string;
         | 
| 15 | 
             
            }
         | 
| 16 |  | 
| 17 | 
            +
            declare interface SpansEmbeddings {
         | 
| 18 | 
            +
            	Doc: string;
         | 
| 19 | 
            +
            	Mention: string[];
         | 
| 20 | 
            +
            	MentionLeft: string[];
         | 
| 21 | 
            +
            	MentionRight: string[];
         | 
| 22 | 
            +
            	Sentence: string[];
         | 
| 23 | 
            +
            }
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            declare interface WordsEmbeddings {
         | 
| 26 | 
            +
            	MentionFirstWord: string;
         | 
| 27 | 
            +
            	MentionHead: string;
         | 
| 28 | 
            +
            	MentionLastWord: string;
         | 
| 29 | 
            +
            	MentionRootHead: string;
         | 
| 30 | 
            +
            	NextWord: string;
         | 
| 31 | 
            +
            	PreviousWord: string;
         | 
| 32 | 
            +
            	SecondNextWord: string;
         | 
| 33 | 
            +
            	SecondPreviousWord: string;
         | 
| 34 | 
            +
            }
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            declare interface MentionFeatures {
         | 
| 37 | 
            +
            	MentionLength: number;
         | 
| 38 | 
            +
            	MentionNormLocation: number;
         | 
| 39 | 
            +
            	MentionType: string;
         | 
| 40 | 
            +
            	IsMentionNested: number;
         | 
| 41 | 
            +
            	DocGenre?:	string | null;
         | 
| 42 | 
            +
            }
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            declare interface MentionsPairFeatures {
         | 
| 45 | 
            +
            	SameSpeaker: number;
         | 
| 46 | 
            +
            	AntMatchMentionSpeaker: number;
         | 
| 47 | 
            +
            	MentionMatchSpeaker: number;
         | 
| 48 | 
            +
            	HeadsAgree: number;
         | 
| 49 | 
            +
            	ExactStringMatch: number;
         | 
| 50 | 
            +
            	RelaxedStringMatch: number;
         | 
| 51 | 
            +
            	SentenceDistance: number;
         | 
| 52 | 
            +
            	MentionDistance: number;
         | 
| 53 | 
            +
            	Overlapping: number;
         | 
| 54 | 
            +
            	M1Features: MentionFeatures;
         | 
| 55 | 
            +
            	M2Features: MentionFeatures;
         | 
| 56 | 
            +
            	DocGenre: string | null;
         | 
| 57 | 
            +
            }
         | 
| 58 | 
            +
             | 
| 59 | 
            +
            declare interface SingleFeatures {
         | 
| 60 | 
            +
            	features: MentionFeatures;
         | 
| 61 | 
            +
            	spansEmbeddings: SpansEmbeddings;
         | 
| 62 | 
            +
            	wordsEmbeddings: WordsEmbeddings;
         | 
| 63 | 
            +
            }
         | 
| 64 | 
            +
             | 
| 65 | 
            +
            declare interface PairFeatures {
         | 
| 66 | 
            +
            	pairFeatures: MentionsPairFeatures;
         | 
| 67 | 
            +
            	antecedentSpansEmbeddings: SpansEmbeddings;
         | 
| 68 | 
            +
            	antecedentWordsEmbeddings: WordsEmbeddings;
         | 
| 69 | 
            +
            	mentionSpansEmbeddings: SpansEmbeddings;
         | 
| 70 | 
            +
            	mentionWordsEmbeddings: WordsEmbeddings;
         | 
| 71 | 
            +
            }
         | 
| 72 | 
            +
             | 
| 73 | 
             
            declare interface Response {
         | 
| 74 | 
             
            	cleanedText: string;
         | 
| 75 | 
             
            	corefResText: string;
         | 
|  | |
| 80 | 
             
            	                                                             /// Single scores are to be compared to the set of pairScores (for the same mention).
         | 
| 81 | 
             
            	                                                             /// If it's higher than every pair score, it's a single mention.
         | 
| 82 | 
             
            	cleanedContext: string;                                      /// Cleaned version of the context.
         | 
| 83 | 
            +
            	singleFeatures: { [id: number]: SingleFeatures | null };
         | 
| 84 | 
            +
            	pairFeatures: { [id: number]: { [id: number]: PairFeatures } };
         | 
| 85 | 
             
            	isResolved: boolean;
         | 
| 86 | 
             
            }
         | 
| 87 |  | 
|  | |
| 120 | 
             
            			if (request.status >= 200 && request.status < 400) {
         | 
| 121 | 
             
            				this.onSuccess();
         | 
| 122 | 
             
            				const res: Response = JSON.parse(request.responseText);
         | 
| 123 | 
            +
            				console.log(res)
         | 
| 124 | 
             
            				this.render(res);
         | 
| 125 | 
             
            			}
         | 
| 126 | 
             
            			else {
         | 

