Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Processing/Article/Article_Data.py
blob: 2be0a7504737c1bbb90743b1be175e6522e92052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Copyright (C) IBM Corporation 2008

import random

""" 
Created by Jonathan Mace

Each class in this file represents the data associated with an element of an article.

These are the data objects which are passed around to and from the Article class.
"""

class Sentence_Data:
    
    def __init__(self, id = None, source_article_id = -1, source_section_id = -1, source_paragraph_id = -1, source_sentence_id = -1, text = "", formatting = None):
        if id == None:
            self.id = random.randint(100, 100000)
        else:
            self.id = id
        self.source_article_id = source_article_id
        self.source_section_id = source_section_id
        self.source_paragraph_id = source_paragraph_id
        self.source_sentence_id = source_sentence_id
        self.text = text
        self.formatting = formatting
        self.type = "sentence"
        
class Picture_Data:
    
    def __init__(self, source_article_id = -1, text = None):
        self.source_article_id = source_article_id
        self.id = 0
        self.text = text
        self.type = "picture"
    

class Paragraph_Data:
    
    def __init__(self, id = None, source_article_id = -1, source_section_id = -1, source_paragraph_id = -1, sentences_data = []):
        if id == None:
            self.id = random.randint(100, 100000)
        else:
            self.id = id
        self.source_article_id = source_article_id
        self.source_section_id = source_section_id
        self.source_paragraph_id = source_paragraph_id
        self.sentences_data = sentences_data
        self.type = "paragraph"

class Section_Data:
    
    def __init__(self, id = None, source_article_id = -1, source_section_id = -1, paragraphs_data = []):
        if id == None:
            self.id = random.randint(100, 100000)
        else:
            self.id = id
        self.source_article_id = source_article_id
        self.source_section_id = source_section_id
        self.paragraphs_data = paragraphs_data 
        self.type = "section" 
        
class Article_Data:
    
    def __init__(self, id = None, source_article_id = -1, article_title = None, article_theme = None, sections_data = [], image_list=[]):
        if id == None:
            self.id = random.randint(100, 100000)
        else:
            self.id = id
        self.source_article_id = source_article_id
        self.article_title = article_title
        self.article_theme = article_theme
        self.sections_data = sections_data
        self.type = "article"
        self.image_list = image_list
    
    def get_image_list(self):
        return self.image_list