Commit 76f35de3 authored by delanoe's avatar delanoe

[FIX] merge correction import.

parents 2ab53773 90bbffd7
...@@ -2,10 +2,13 @@ ...@@ -2,10 +2,13 @@
'use strict'; 'use strict';
var annotationsAppDocument = angular.module('annotationsAppDocument', ['annotationsAppHttp']); var annotationsAppDocument = angular.module('annotationsAppDocument', ['annotationsAppHttp']);
annotationsAppDocument.controller('DocController', annotationsAppDocument.controller('DocController',
['$scope', '$rootScope', '$timeout', 'NgramListHttpService', 'DocumentHttpService', ['$scope', '$rootScope', '$timeout', 'NgramListHttpService', 'DocumentHttpService',
function ($scope, $rootScope, $timeout, NgramListHttpService, DocumentHttpService) { function ($scope, $rootScope, $timeout, NgramListHttpService, DocumentHttpService) {
// dataLoading = signal pour afficher wait
$scope.dataLoading = true ;
$rootScope.documentResource = DocumentHttpService.get( $rootScope.documentResource = DocumentHttpService.get(
{'docId': $rootScope.docId}, {'docId': $rootScope.docId},
function(data, responseHeaders) { function(data, responseHeaders) {
...@@ -27,6 +30,7 @@ ...@@ -27,6 +30,7 @@
function(data) { function(data) {
$rootScope.annotations = data[$rootScope.corpusId.toString()][$rootScope.docId.toString()]; $rootScope.annotations = data[$rootScope.corpusId.toString()][$rootScope.docId.toString()];
$rootScope.lists = data[$rootScope.corpusId.toString()].lists; $rootScope.lists = data[$rootScope.corpusId.toString()].lists;
$scope.dataLoading = false ;
}, },
function(data) { function(data) {
console.error("unable to get the list of ngrams"); console.error("unable to get the list of ngrams");
...@@ -34,6 +38,7 @@ ...@@ -34,6 +38,7 @@
); );
}); });
// TODO setup article pagination // TODO setup article pagination
$scope.onPreviousClick = function () { $scope.onPreviousClick = function () {
DocumentHttpService.get($scope.docId - 1); DocumentHttpService.get($scope.docId - 1);
......
...@@ -86,6 +86,16 @@ ...@@ -86,6 +86,16 @@
<li class="list-group-item small"><span class="badge">date</span>{[{publication_date}]}</li> <li class="list-group-item small"><span class="badge">date</span>{[{publication_date}]}</li>
</ul> </ul>
</div> </div>
<div ng-if="dataLoading">
Loading text...
<br>
<center>
<img width="10%" src="{% static 'img/ajax-loader.gif'%}"></img>
</center>
<br>
</div>
<div ng-if="abstract_text != null"> <div ng-if="abstract_text != null">
<span class="badge">abstract</span> <span class="badge">abstract</span>
</div> </div>
......
This diff is collapsed.
# from ..Taggers import NltkTagger # from ..Taggers import NltkTagger
from ..Taggers import TurboTagger from ..Taggers import TurboTagger
import nltk import nltk
from re import sub
"""Base class for all ngrams extractors. """Base class for all ngrams extractors.
...@@ -33,9 +34,21 @@ class NgramsExtractor: ...@@ -33,9 +34,21 @@ class NgramsExtractor:
Returns a list of the ngrams found in the given text. Returns a list of the ngrams found in the given text.
""" """
def extract_ngrams(self, contents): def extract_ngrams(self, contents):
tagged_tokens = list(self.tagger.tag_text(contents)) clean_contents = self._prepare_text(contents)
# ici tagging
tagged_tokens = list(self.tagger.tag_text(clean_contents))
if len(tagged_tokens): if len(tagged_tokens):
grammar_parsed = self._grammar.parse(tagged_tokens) grammar_parsed = self._grammar.parse(tagged_tokens)
for subtree in grammar_parsed.subtrees(): for subtree in grammar_parsed.subtrees():
if subtree.label() == self._label: if subtree.label() == self._label:
yield subtree.leaves() yield subtree.leaves()
@staticmethod
def _prepare_text(text_contents):
"""
Clean the text for better POS tagging
"""
# strip xml tags
return sub(r"<[^>]{0,45}>","",text_contents)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment