Skip to content

Commit

Permalink
adding missed files
Browse files Browse the repository at this point in the history
  • Loading branch information
nanchenchen committed Aug 21, 2015
1 parent 8bda0c2 commit cefcdc2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
20 changes: 20 additions & 0 deletions msgvis/apps/enhance/management/commands/build_tweet_dictionary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from django.core.management.base import BaseCommand, make_option, CommandError

class Command(BaseCommand):
help = "From Tweet Parser results, extract words and connect with messages for a dataset."
args = "<dataset id> <filename>"


def handle(self, dataset_id, filename, *args, **options):


if not dataset_id:
raise CommandError("Dataset id is required.")
try:
dataset_id = int(dataset_id)
except ValueError:
raise CommandError("Dataset id must be a number.")

from msgvis.apps.enhance.tasks import import_from_tweet_parser_results

import_from_tweet_parser_results(dataset_id, filename)
28 changes: 28 additions & 0 deletions msgvis/apps/enhance/migrations/0012_tweetword.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
import msgvis.apps.base.models


class Migration(migrations.Migration):

dependencies = [
('corpus', '0019_auto_20150331_2129'),
('enhance', '0011_dictionary_dataset'),
]

operations = [
migrations.CreateModel(
name='TweetWord',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('text', msgvis.apps.base.models.Utf8CharField(max_length=100)),
('dataset', models.ForeignKey(related_name='tweet_words', default=None, blank=True, to='corpus.Dataset', null=True)),
('messages', models.ManyToManyField(related_name='tweet_words', to='corpus.Message')),
],
options={
},
bases=(models.Model,),
),
]

0 comments on commit cefcdc2

Please sign in to comment.