Commit 5fc7c2d7 authored by Mathieu Rodic's avatar Mathieu Rodic

[CODE] The API is now wrapped in a controller.

NgramsCache: ngrams are now stored in lowercase
parent 281e712a
This diff is collapsed.
......@@ -40,9 +40,9 @@ urlpatterns = patterns('',
url(r'^chart/corpus/(\d+)/data.csv$', send_csv),
url(r'^graph.json$', send_graph),
url(r'^api/corpus/(\d+)/ngrams$', gargantext_web.api.corpus_ngrams),
url(r'^api/corpus/(\d+)/metadata$', gargantext_web.api.corpus_metadata),
url(r'^api/corpus/(\d+)/data$', gargantext_web.api.corpus_data),
url(r'^api/corpus/(\d+)/ngrams$', gargantext_web.api.CorpusController.ngrams),
url(r'^api/corpus/(\d+)/metadata$', gargantext_web.api.CorpusController.metadata),
url(r'^api/corpus/(\d+)/data$', gargantext_web.api.CorpusController.data),
)
from django.conf import settings
......
......@@ -16,6 +16,7 @@ class NgramsCache(defaultdict):
def __missing__(self, terms):
"""If the terms are not yet present in the dictionary,
retrieve it from the database or insert it."""
terms = terms.strip().lower()
try:
ngram = node.models.Ngram.get(terms=terms, language=self.language)
except:
......
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