-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8bda0c2
commit cefcdc2
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
msgvis/apps/enhance/management/commands/build_tweet_dictionary.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,), | ||
), | ||
] |