Coming off a NLTK NER problem, I have PERSONS and ORGANIZATIONS, which I need to store in a sqlite3 db. The obtained wisdom is that I need to create separate TABLEs to hold these sets. How can i create a TABLE when len(PERSONs) could vary for each id. It can even be zero. The normal use of: insert into table_name values (?),(t[0]) will return a fail.
Asked
Active
Viewed 176 times
0
-
you need a third table to express many to one relationship (or many to many) i.e. that more than one person can be in a given organization (or one person can be in more than one organization) – Paweł Kordowski Jan 16 '16 at 07:52
-
@PawełKordowski: Let me explain, it is not about a many to one/many relationship. There are a million or so text samples. I have NLP/NER processed them. so each story (id) has {PERSONS} and {ORGANIZATIONS}. Problem is that the length of these sets could be zero to ten (max, because I have extracted ten most_common). There may be stories with no Named Entity, also. How do i stuff this into sqlite3 db, so that the fields are query-able? – Pradeep Jan 16 '16 at 08:19
-
In the paws case (http://stackoverflow.com/a/3738402/4737317), there were a fixed set of data points for each id. Here, the number of data points will vary. – Pradeep Jan 16 '16 at 08:21
-
This looks like a plain many-to-many relation. If not, show some example data. – CL. Jan 16 '16 at 10:00
1 Answers
0
Thanks to CL.'s comment, I figured out the best way is to think rows in a two-column table, where the first column is id INT, and the second column contains person_names. This way, there will be no issue with varying lengths of PERSONS list. of course, to link the main table with the persons table, the id field has to REFERENCE (foreign keys) to the story_id (main table).

Pradeep
- 350
- 3
- 16