shivi commited on
Commit
38f8c33
·
1 Parent(s): ff7ac95

update app theme

Browse files
app.py CHANGED
@@ -1,23 +1,59 @@
 
 
1
  import gradio as gr
2
- import random
3
- import time
4
- from base.legal_document_utils import summarize, question_answer, load_gpl_license, load_pokemon_license
5
- from base.qdrant_cohere_utils import cross_lingual_document_search, translate_output
6
- from base.examples import (
7
- GPL_LICENSE_DOC,
8
- GPL_LICENSE_QUESTION,
9
- POKEMON_GO_TERMS_OF_SERVICE,
10
- POKEMON_GO_QUESTION,
11
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  max_search_results = 3
14
 
 
15
  def reset_chatbot():
16
  return gr.update(value="")
17
 
18
 
19
- def user(input_question, history, qa_bot_state):
20
- return "", history + [[input_question, None]], qa_bot_state
21
 
22
 
23
  def legal_doc_qa_bot(input_document, history):
@@ -26,7 +62,7 @@ def legal_doc_qa_bot(input_document, history):
26
  return history
27
 
28
 
29
- with gr.Blocks() as demo:
30
  gr.HTML(
31
  """<html><center><img src='file/logo/flc_design4.png', alt='Legal-ease logo', width=250, height=250 /></center><br></html>"""
32
  )
@@ -35,40 +71,56 @@ with gr.Blocks() as demo:
35
 
36
  with gr.Tabs():
37
  with gr.TabItem("Q&A"):
38
- gr.HTML("""<p style="text-align:center;"><b>Legal documents can be difficult to comprehend and understand. Add a legal document below and ask any questions related to it.</p>""")
 
 
 
39
  with gr.Row():
40
  with gr.Column():
41
  input_document = gr.Text(label="Copy your document here", lines=10)
42
 
43
  with gr.Column():
44
  chatbot = gr.Chatbot(label="Chat History")
45
- input_question = gr.Text(label="Ask a question", placeholder="Type a question here and hit enter.")
46
- clear = gr.Button("Clear")
 
 
 
47
 
48
  with gr.Row():
49
- with gr.Accordion("Show example inputs I can load:", open=False):
50
- example_1 = gr.Button("Load GPL License Document")
51
- example_2 = gr.Button("Load Pokemon Go Terms of Service")
 
 
 
 
52
 
53
  with gr.TabItem("Summarize"):
54
- gr.HTML("""<p style="text-align:center;"><b>Legal documents can be very lengthy. Add a legal document below and generate a quick summary for it.</p>""")
 
 
 
55
  with gr.Row():
56
  with gr.Column():
57
  summary_input = gr.Text(label="Document", lines=10)
58
- generate_summary = gr.Button("Generate Summary")
59
 
60
  with gr.Column():
61
  summary_output = gr.Text(label="Summary", lines=10)
62
  invisible_comp = gr.Text(label="Dummy Component", visible=False)
63
 
64
  with gr.Row():
65
- with gr.Accordion("Advanced Settings:", open=False):
66
-
67
  summary_length = gr.Radio(
68
- ["short", "medium", "long"], label="Summary Length", value="long"
 
 
69
  )
70
  summary_format = gr.Radio(
71
- ["paragraph", "bullets"], label="Summary Format", value="bullets"
 
 
72
  )
73
  extractiveness = gr.Radio(
74
  ["low", "medium", "high"],
@@ -87,68 +139,117 @@ with gr.Blocks() as demo:
87
  label="Temperature",
88
  info="Controls the randomness of the output. Lower values tend to generate more “predictable” output, while higher values tend to generate more “creative” output.",
89
  )
90
-
91
  with gr.Row():
92
- with gr.Accordion("Show example inputs I can load:", open=False):
93
- example_3 = gr.Button("Load GPL License Document")
94
- example_4 = gr.Button("Load Pokemon Go Terms of Service")
95
-
 
 
 
 
96
  with gr.TabItem("Document Search"):
97
- gr.HTML("""<p style="text-align:center;"><b>Search across a set of legal documents in any language or even a mix of languages. Query them using any one of over 100 supported languages.</p>""")
98
- gr.HTML("""<p style="text-align:center; font-style:italic;">Get started with a pre-indexed set of documents from eight European countries (Belgium, France, Hungary, Italy, Netherlands, Norway, Poland, UK) in seven languages, outlining legislation passed during the COVID-19 pandemic.</p>""")
99
-
100
- # gr.Markdown("""Search across a set of legal documents in any language or even a mix of languages. Query them using any one of over 100 supported languages.
101
- # To get you started, we have indexed a set of documents from eight European countries (Belgium, France, Hunary, Italy, Netherlands, Norway, Poland, UK) in seven languages, outlining legislation passed during the COVID-19 pandemic.""")
102
-
 
103
  with gr.Row():
104
- text_match = gr.CheckboxGroup(["Full Text Search"], label="find exact text in documents")
105
- doc_choices = gr.CheckboxGroup(["contracts", "legislations", "caselaw", "terms of service"], label="Search through these documents", visible=False)
 
 
106
  with gr.Row():
107
- lang_choices = gr.CheckboxGroup(["English", "French", "Italian", "Dutch", "Polish", "Hungarian", "Norwegian"], label="Filter results based on language")
108
-
 
 
 
 
 
 
 
 
 
 
 
109
  with gr.Row():
110
  with gr.Column():
111
- user_query = gr.Text(label="Enter query here", placeholder="Search through all your documents")
112
-
113
- num_search_results = gr.Slider(1, max_search_results, visible=False, value=max_search_results, step=1, interactive=True, label="How many search results to show:")
114
-
 
 
 
 
 
 
 
 
 
 
 
115
  with gr.Row():
116
  with gr.Column():
117
  query_match_out_1 = gr.Textbox(label=f"Search Result 1")
118
-
119
  with gr.Column():
120
  with gr.Accordion("Translate Search Result", open=False):
121
- translate_1 = gr.Button(label="Translate", value="Translate")
122
- translate_res_1 = gr.Textbox(label=f"Translation Result 1")
123
-
 
 
 
 
 
 
124
  with gr.Row():
125
  with gr.Column():
126
  query_match_out_2 = gr.Textbox(label=f"Search Result 2")
127
 
128
  with gr.Column():
129
  with gr.Accordion("Translate Search Result", open=False):
130
- translate_2 = gr.Button(label="Translate", value="Translate")
131
- translate_res_2 = gr.Textbox(label=f"Translation Result 2")
132
-
133
- with gr.Row():
 
 
 
 
 
 
134
  with gr.Column():
135
  query_match_out_3 = gr.Textbox(label=f"Search Result 3")
136
 
137
  with gr.Column():
138
  with gr.Accordion("Translate Search Result", open=False):
139
- translate_3 = gr.Button(label="Translate", value="Translate")
140
- translate_res_3 = gr.Textbox(label=f"Translation Result 3")
141
-
142
-
 
 
 
 
 
143
  # fetch answer for submitted question corresponding to input document
144
  input_question.submit(
145
- user, [input_question, chatbot, qa_bot_state], [input_question, chatbot, qa_bot_state], queue=False
 
 
 
146
  ).then(legal_doc_qa_bot, [input_document, chatbot], chatbot)
147
 
148
  # reset the chatbot Q&A history when input document changes
149
  input_document.change(fn=reset_chatbot, inputs=[], outputs=chatbot)
150
 
151
- # load gpl example for Q&A task
152
  example_1.click(
153
  load_gpl_license,
154
  [],
@@ -156,7 +257,6 @@ with gr.Blocks() as demo:
156
  queue=False,
157
  )
158
 
159
- # load pokemon go example for Q&A task
160
  example_2.click(
161
  load_pokemon_license,
162
  [],
@@ -164,7 +264,7 @@ with gr.Blocks() as demo:
164
  queue=False,
165
  )
166
 
167
- # load gpl example for summarization task
168
  example_3.click(
169
  load_gpl_license,
170
  [],
@@ -172,14 +272,13 @@ with gr.Blocks() as demo:
172
  queue=False,
173
  )
174
 
175
- # load pokemon go example for summarization task
176
  example_4.click(
177
  load_pokemon_license,
178
  [],
179
  [summary_input, invisible_comp],
180
  queue=False,
181
  )
182
-
183
  # generate summary corresponding to document submitted by the user.
184
  generate_summary.click(
185
  summarize,
@@ -190,33 +289,42 @@ with gr.Blocks() as demo:
190
 
191
  # clear the chatbot Q&A history when this button is clicked by the user
192
  clear.click(lambda: None, None, chatbot, queue=False)
193
-
194
  # run search as user is typing the query
195
- user_query.change(cross_lingual_document_search, [user_query, num_search_results, lang_choices, doc_choices, text_match], [query_match_out_1, query_match_out_2, query_match_out_3], queue=False)
196
-
 
 
 
 
 
197
  # run search if user submits query
198
- user_query.submit(cross_lingual_document_search, [user_query, num_search_results, lang_choices, doc_choices, text_match], [query_match_out_1, query_match_out_2, query_match_out_3], queue=False)
199
-
200
-
 
 
 
 
201
  # translate results corresponding to 1st search result obtained if user clicks 'Translate'
202
  translate_1.click(
203
- translate_output,
204
  [query_match_out_1, user_query],
205
  [translate_res_1],
206
  queue=False,
207
  )
208
-
209
  # translate results corresponding to 2nd search result obtained if user clicks 'Translate'
210
  translate_2.click(
211
- translate_output,
212
  [query_match_out_2, user_query],
213
  [translate_res_2],
214
  queue=False,
215
  )
216
-
217
  # translate results corresponding to 3rd search result obtained if user clicks 'Translate'
218
  translate_3.click(
219
- translate_output,
220
  [query_match_out_3, user_query],
221
  [translate_res_3],
222
  queue=False,
 
1
+ from __future__ import annotations
2
+ from typing import Iterable
3
  import gradio as gr
4
+ from base.legal_document_utils import (
5
+ summarize,
6
+ question_answer,
7
+ load_gpl_license,
8
+ load_pokemon_license,
 
 
 
 
9
  )
10
+ from base.document_search import cross_lingual_document_search, translate_search_result
11
+ from gradio.themes.base import Base
12
+ from gradio.themes import Soft
13
+ from gradio.themes.utils import colors, fonts, sizes
14
+
15
+
16
+ class SoftTheme(Soft):
17
+ def __init__(
18
+ self,
19
+ *,
20
+ primary_hue: colors.Color | str = colors.blue,
21
+ secondary_hue: colors.Color | str = colors.cyan,
22
+ neutral_hue: colors.Color | str = colors.zinc,
23
+ spacing_size: sizes.Size | str = sizes.spacing_md,
24
+ radius_size: sizes.Size | str = sizes.radius_md,
25
+ text_size: sizes.Size | str = sizes.text_lg,
26
+ ):
27
+ super().__init__(
28
+ primary_hue=primary_hue,
29
+ secondary_hue=secondary_hue,
30
+ neutral_hue=neutral_hue,
31
+ spacing_size=spacing_size,
32
+ radius_size=radius_size,
33
+ text_size=text_size,
34
+ )
35
+ super().set(
36
+ button_primary_background_fill="linear-gradient(90deg, *primary_300, *secondary_400)",
37
+ button_primary_background_fill_hover="linear-gradient(90deg, *primary_200, *secondary_300)",
38
+ button_primary_text_color="white",
39
+ button_primary_background_fill_dark="linear-gradient(90deg, *primary_600, *secondary_800)",
40
+ block_shadow="*shadow_drop_lg",
41
+ button_shadow="*shadow_drop_lg",
42
+ )
43
+
44
+
45
+ softheme = SoftTheme()
46
+
47
 
48
  max_search_results = 3
49
 
50
+
51
  def reset_chatbot():
52
  return gr.update(value="")
53
 
54
 
55
+ def get_user_input(input_question, history):
56
+ return "", history + [[input_question, None]]
57
 
58
 
59
  def legal_doc_qa_bot(input_document, history):
 
62
  return history
63
 
64
 
65
+ with gr.Blocks(theme=softheme) as demo:
66
  gr.HTML(
67
  """<html><center><img src='file/logo/flc_design4.png', alt='Legal-ease logo', width=250, height=250 /></center><br></html>"""
68
  )
 
71
 
72
  with gr.Tabs():
73
  with gr.TabItem("Q&A"):
74
+ gr.HTML(
75
+ """<p style="text-align:center;"><b>Legal documents can be difficult to comprehend and understand. Add a legal document below and ask any questions related to it.</p>"""
76
+ )
77
+
78
  with gr.Row():
79
  with gr.Column():
80
  input_document = gr.Text(label="Copy your document here", lines=10)
81
 
82
  with gr.Column():
83
  chatbot = gr.Chatbot(label="Chat History")
84
+ input_question = gr.Text(
85
+ label="Ask a question",
86
+ placeholder="Type a question here and hit enter.",
87
+ )
88
+ clear = gr.Button("Clear", variant="primary")
89
 
90
  with gr.Row():
91
+ with gr.Accordion("Show example inputs I can load:", open=True):
92
+ example_1 = gr.Button(
93
+ "Load GPL License Document", variant="primary"
94
+ )
95
+ example_2 = gr.Button(
96
+ "Load Pokemon Go Terms of Service", variant="primary"
97
+ )
98
 
99
  with gr.TabItem("Summarize"):
100
+ gr.HTML(
101
+ """<p style="text-align:center;"><b>Legal documents can be very lengthy. Add a legal document below and generate a quick summary for it.</p>"""
102
+ )
103
+
104
  with gr.Row():
105
  with gr.Column():
106
  summary_input = gr.Text(label="Document", lines=10)
107
+ generate_summary = gr.Button("Generate Summary", variant="primary")
108
 
109
  with gr.Column():
110
  summary_output = gr.Text(label="Summary", lines=10)
111
  invisible_comp = gr.Text(label="Dummy Component", visible=False)
112
 
113
  with gr.Row():
114
+ with gr.Accordion("Advanced Settings:", open=True):
 
115
  summary_length = gr.Radio(
116
+ ["short", "medium", "long"],
117
+ label="Summary Length",
118
+ value="long",
119
  )
120
  summary_format = gr.Radio(
121
+ ["paragraph", "bullets"],
122
+ label="Summary Format",
123
+ value="bullets",
124
  )
125
  extractiveness = gr.Radio(
126
  ["low", "medium", "high"],
 
139
  label="Temperature",
140
  info="Controls the randomness of the output. Lower values tend to generate more “predictable” output, while higher values tend to generate more “creative” output.",
141
  )
142
+
143
  with gr.Row():
144
+ with gr.Accordion("Show example inputs I can load:", open=True):
145
+ example_3 = gr.Button(
146
+ "Load GPL License Document", variant="primary"
147
+ )
148
+ example_4 = gr.Button(
149
+ "Load Pokemon Go Terms of Service", variant="primary"
150
+ )
151
+
152
  with gr.TabItem("Document Search"):
153
+ gr.HTML(
154
+ """<p style="text-align:center;"><b>Search across a set of legal documents in any language or even a mix of languages. Query them using any one of over 100 supported languages.</p>"""
155
+ )
156
+ gr.HTML(
157
+ """<p style="text-align:center; font-style:italic;">Get started with a pre-indexed set of documents from eight European countries (Belgium, France, Hungary, Italy, Netherlands, Norway, Poland, UK) in seven languages, outlining legislation passed during the COVID-19 pandemic.</p>"""
158
+ )
159
+
160
  with gr.Row():
161
+ text_match = gr.CheckboxGroup(
162
+ ["Full Text Search"], label="find exact text in documents"
163
+ )
164
+
165
  with gr.Row():
166
+ lang_choices = gr.CheckboxGroup(
167
+ [
168
+ "English",
169
+ "French",
170
+ "Italian",
171
+ "Dutch",
172
+ "Polish",
173
+ "Hungarian",
174
+ "Norwegian",
175
+ ],
176
+ label="Filter results based on language",
177
+ )
178
+
179
  with gr.Row():
180
  with gr.Column():
181
+ user_query = gr.Text(
182
+ label="Enter query here",
183
+ placeholder="Search through all your documents",
184
+ )
185
+
186
+ num_search_results = gr.Slider(
187
+ 1,
188
+ max_search_results,
189
+ visible=False,
190
+ value=max_search_results,
191
+ step=1,
192
+ interactive=True,
193
+ label="How many search results to show:",
194
+ )
195
+
196
  with gr.Row():
197
  with gr.Column():
198
  query_match_out_1 = gr.Textbox(label=f"Search Result 1")
199
+
200
  with gr.Column():
201
  with gr.Accordion("Translate Search Result", open=False):
202
+ translate_1 = gr.Button(
203
+ label="Translate",
204
+ value="Translate",
205
+ variant="primary",
206
+ )
207
+ translate_res_1 = gr.Textbox(
208
+ label=f"Translation Result 1"
209
+ )
210
+
211
  with gr.Row():
212
  with gr.Column():
213
  query_match_out_2 = gr.Textbox(label=f"Search Result 2")
214
 
215
  with gr.Column():
216
  with gr.Accordion("Translate Search Result", open=False):
217
+ translate_2 = gr.Button(
218
+ label="Translate",
219
+ value="Translate",
220
+ variant="primary",
221
+ )
222
+ translate_res_2 = gr.Textbox(
223
+ label=f"Translation Result 2"
224
+ )
225
+
226
+ with gr.Row():
227
  with gr.Column():
228
  query_match_out_3 = gr.Textbox(label=f"Search Result 3")
229
 
230
  with gr.Column():
231
  with gr.Accordion("Translate Search Result", open=False):
232
+ translate_3 = gr.Button(
233
+ label="Translate",
234
+ value="Translate",
235
+ variant="primary",
236
+ )
237
+ translate_res_3 = gr.Textbox(
238
+ label=f"Translation Result 3"
239
+ )
240
+
241
  # fetch answer for submitted question corresponding to input document
242
  input_question.submit(
243
+ get_user_input,
244
+ [input_question, chatbot],
245
+ [input_question, chatbot],
246
+ queue=False,
247
  ).then(legal_doc_qa_bot, [input_document, chatbot], chatbot)
248
 
249
  # reset the chatbot Q&A history when input document changes
250
  input_document.change(fn=reset_chatbot, inputs=[], outputs=chatbot)
251
 
252
+ # Loading examples on click for Q&A module
253
  example_1.click(
254
  load_gpl_license,
255
  [],
 
257
  queue=False,
258
  )
259
 
 
260
  example_2.click(
261
  load_pokemon_license,
262
  [],
 
264
  queue=False,
265
  )
266
 
267
+ # Loading examples on click for Q&A module
268
  example_3.click(
269
  load_gpl_license,
270
  [],
 
272
  queue=False,
273
  )
274
 
 
275
  example_4.click(
276
  load_pokemon_license,
277
  [],
278
  [summary_input, invisible_comp],
279
  queue=False,
280
  )
281
+
282
  # generate summary corresponding to document submitted by the user.
283
  generate_summary.click(
284
  summarize,
 
289
 
290
  # clear the chatbot Q&A history when this button is clicked by the user
291
  clear.click(lambda: None, None, chatbot, queue=False)
292
+
293
  # run search as user is typing the query
294
+ user_query.change(
295
+ cross_lingual_document_search,
296
+ [user_query, num_search_results, lang_choices, text_match],
297
+ [query_match_out_1, query_match_out_2, query_match_out_3],
298
+ queue=False,
299
+ )
300
+
301
  # run search if user submits query
302
+ user_query.submit(
303
+ cross_lingual_document_search,
304
+ [user_query, num_search_results, lang_choices, text_match],
305
+ [query_match_out_1, query_match_out_2, query_match_out_3],
306
+ queue=False,
307
+ )
308
+
309
  # translate results corresponding to 1st search result obtained if user clicks 'Translate'
310
  translate_1.click(
311
+ translate_search_result,
312
  [query_match_out_1, user_query],
313
  [translate_res_1],
314
  queue=False,
315
  )
316
+
317
  # translate results corresponding to 2nd search result obtained if user clicks 'Translate'
318
  translate_2.click(
319
+ translate_search_result,
320
  [query_match_out_2, user_query],
321
  [translate_res_2],
322
  queue=False,
323
  )
324
+
325
  # translate results corresponding to 3rd search result obtained if user clicks 'Translate'
326
  translate_3.click(
327
+ translate_search_result,
328
  [query_match_out_3, user_query],
329
  [translate_res_3],
330
  queue=False,
base/.ipynb_checkpoints/examples-checkpoint.csv DELETED
@@ -1,223 +0,0 @@
1
- id,doc,question
2
- 1,"The GNU General Public License is a free, copyleft license for software and other kinds of works.
3
-
4
- The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
5
-
6
- When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
7
-
8
- To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
9
-
10
- For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
11
-
12
- Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
13
-
14
- For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
15
-
16
- Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
17
-
18
- Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
19
-
20
- The precise terms and conditions for copying, distribution and modification follow.
21
-
22
- TERMS AND CONDITIONS
23
- 0. Definitions.
24
- “This License” refers to version 3 of the GNU General Public License.
25
-
26
- “Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
27
-
28
- “The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
29
-
30
- To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
31
-
32
- A “covered work” means either the unmodified Program or a work based on the Program.
33
-
34
- To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
35
-
36
- To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
37
-
38
- An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
39
-
40
- 1. Source Code.
41
- The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
42
-
43
- A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
44
-
45
- The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
46
-
47
- The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
48
-
49
- The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
50
-
51
- The Corresponding Source for a work in source code form is that same work.
52
-
53
- 2. Basic Permissions.
54
- All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
55
-
56
- You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
57
-
58
- Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
59
-
60
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
61
- No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
62
-
63
- When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
64
-
65
- 4. Conveying Verbatim Copies.
66
- You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
67
-
68
- You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
69
-
70
- 5. Conveying Modified Source Versions.
71
- You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
72
-
73
- a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
74
- b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
75
- c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
76
- d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
77
- A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
78
-
79
- 6. Conveying Non-Source Forms.
80
- You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
81
-
82
- a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
83
- b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
84
- c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
85
- d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
86
- e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
87
- A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
88
-
89
- A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
90
-
91
- “Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
92
-
93
- If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
94
-
95
- The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
96
-
97
- Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
98
-
99
- 7. Additional Terms.
100
- “Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
101
-
102
- When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
103
-
104
- Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
105
-
106
- a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
107
- b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
108
- c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
109
- d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
110
- e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
111
- f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
112
- All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
113
-
114
- If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
115
-
116
- Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
117
-
118
- 8. Termination.
119
- You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
120
-
121
- However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
122
-
123
- Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
124
-
125
- Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
126
-
127
- 9. Acceptance Not Required for Having Copies.
128
- You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
129
-
130
- 10. Automatic Licensing of Downstream Recipients.
131
- Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
132
-
133
- An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
134
-
135
- You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
136
-
137
- 11. Patents.
138
- A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
139
-
140
- A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
141
-
142
- Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
143
-
144
- In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
145
-
146
- If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
147
-
148
- If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
149
-
150
- A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
151
-
152
- Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
153
-
154
- 12. No Surrender of Others' Freedom.
155
- If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
156
-
157
- 13. Use with the GNU Affero General Public License.
158
- Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
159
-
160
- 14. Revised Versions of this License.
161
- The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
162
-
163
- Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
164
-
165
- If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
166
-
167
- Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
168
-
169
- 15. Disclaimer of Warranty.
170
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
171
-
172
- 16. Limitation of Liability.
173
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
174
-
175
- 17. Interpretation of Sections 15 and 16.
176
- If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
177
-
178
- END OF TERMS AND CONDITIONS
179
-
180
- How to Apply These Terms to Your New Programs
181
- If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
182
-
183
- To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
184
-
185
- <one line to give the program's name and a brief idea of what it does.>
186
- Copyright (C) <year> <name of author>
187
-
188
- This program is free software: you can redistribute it and/or modify
189
- it under the terms of the GNU General Public License as published by
190
- the Free Software Foundation, either version 3 of the License, or
191
- (at your option) any later version.
192
-
193
- This program is distributed in the hope that it will be useful,
194
- but WITHOUT ANY WARRANTY; without even the implied warranty of
195
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
196
- GNU General Public License for more details.
197
-
198
- You should have received a copy of the GNU General Public License
199
- along with this program. If not, see <https://www.gnu.org/licenses/>.
200
- Also add information on how to contact you by electronic and paper mail.
201
-
202
- If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
203
-
204
- <program> Copyright (C) <year> <name of author>
205
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
206
- This is free software, and you are welcome to redistribute it
207
- under certain conditions; type `show c' for details.
208
- The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
209
-
210
- You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
211
-
212
- The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/licenses/why-not-lgpl.html>.",what does the document say about distributing programs using GPL license?
213
- 2,"welcome to the pokémon go video game services which are accessible via the niantic inc niantic mobile device application. This section of the license describes who is eligible to use the services. Unless stated otherwise for a particular Service, children are not allowed to use the Services. A “Child“ is a person (a) under 13 years old (for residents outside of the EEA, except for the Republic of Korea); (b) under 16 years old or such age needed to consent to the processing of personal data in their country of residence (for residents of the EEA); or (c) under 14 years old (for residents of the Republic of Korea). Niantic Game and App Resources contains information on the age requirement for each of our Apps. \
214
- \
215
- For Services that permit Child participation, parents or legal guardians (“Parents“) must provide verified consent. Parents can provide and verify their consent through the Niantic Kids Parent Portal, or through another authorized third-party provider made available through the Service. Where Parental consent is required, Niantic recommends that Parents monitor the Child’s online activity and use of the Service. \
216
- \
217
- The verification and consent process for Children is performed by one of several third-party providers (“Verification Provider“). The Parent must register with the Verification Provider before a Child may use the Services. The Verification Provider will ask the Parent to verify their identity and to consent to the creation of an Account for the Child. Upon receipt of Parent verification and consent, the Verification Provider will enable the Parent to create an Account for the Child. Parental consent applies exclusively to the Service for which it has been granted. \
218
- \
219
- A Parent who wishes to rescind their previously-provided consent to a Child’s access to and use of the Services should follow the instructions for Account deletion, which can be found in the respective help centers here. \
220
- \
221
- Purchases made through the Services are limited to Account holders who either (a) are the age needed to consent to a contract in their country of residence; or (b) if younger, have the consent of a Parent to use the Service. Parents can consult their device settings for the App to restrict in-App purchases by a Child, and should also monitor activity in their Child’s Account, including the purchase of Virtual Money or Virtual Goods. \
222
- \
223
- TO THE EXTENT PERMITTED UNDER APPLICABLE LAW, NIANTIC DECLINES ANY RESPONSIBILITY REGARDING ANY ACTIVITIES CONDUCTED BY A CHILD WITH OR WITHOUT THE PERMISSION OF A PARENT. IF YOU ARE A PARENT AND YOU GIVE YOUR PERMISSION FOR YOUR CHILD TO REGISTER FOR ONE OF THE SERVICES, YOU THEREBY AGREE TO THE TERMS RELATING TO USE OF THE SERVICES BY YOUR CHILD.","If I am below 13 years old, can I play this game?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
base/.ipynb_checkpoints/examples-checkpoint.py DELETED
@@ -1,249 +0,0 @@
1
- GPL_LICENSE_DOC = """
2
- The GNU General Public License is a free, copyleft license for software and other kinds of works.
3
-
4
- The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
5
-
6
- When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
7
-
8
- To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
9
-
10
- For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
11
-
12
- Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
13
-
14
- For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
15
-
16
- Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
17
-
18
- Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
19
-
20
- The precise terms and conditions for copying, distribution and modification follow.
21
-
22
- TERMS AND CONDITIONS
23
- 0. Definitions.
24
- “This License” refers to version 3 of the GNU General Public License.
25
-
26
- “Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
27
-
28
- “The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
29
-
30
- To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
31
-
32
- A “covered work” means either the unmodified Program or a work based on the Program.
33
-
34
- To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
35
-
36
- To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
37
-
38
- An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
39
-
40
- 1. Source Code.
41
- The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
42
-
43
- A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
44
-
45
- The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
46
-
47
- The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
48
-
49
- The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
50
-
51
- The Corresponding Source for a work in source code form is that same work.
52
-
53
- 2. Basic Permissions.
54
- All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
55
-
56
- You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
57
-
58
- Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
59
-
60
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
61
- No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
62
-
63
- When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
64
-
65
- 4. Conveying Verbatim Copies.
66
- You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
67
-
68
- You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
69
-
70
- 5. Conveying Modified Source Versions.
71
- You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
72
-
73
- a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
74
- b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
75
- c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
76
- d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
77
- A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
78
-
79
- 6. Conveying Non-Source Forms.
80
- You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
81
-
82
- a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
83
- b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
84
- c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
85
- d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
86
- e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
87
- A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
88
-
89
- A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
90
-
91
- “Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
92
-
93
- If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
94
-
95
- The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
96
-
97
- Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
98
-
99
- 7. Additional Terms.
100
- “Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
101
-
102
- When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
103
-
104
- Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
105
-
106
- a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
107
- b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
108
- c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
109
- d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
110
- e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
111
- f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
112
- All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
113
-
114
- If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
115
-
116
- Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
117
-
118
- 8. Termination.
119
- You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
120
-
121
- However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
122
-
123
- Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
124
-
125
- Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
126
-
127
- 9. Acceptance Not Required for Having Copies.
128
- You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
129
-
130
- 10. Automatic Licensing of Downstream Recipients.
131
- Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
132
-
133
- An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
134
-
135
- You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
136
-
137
- 11. Patents.
138
- A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
139
-
140
- A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
141
-
142
- Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
143
-
144
- In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
145
-
146
- If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
147
-
148
- If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
149
-
150
- A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
151
-
152
- Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
153
-
154
- 12. No Surrender of Others' Freedom.
155
- If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
156
-
157
- 13. Use with the GNU Affero General Public License.
158
- Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
159
-
160
- 14. Revised Versions of this License.
161
- The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
162
-
163
- Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
164
-
165
- If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
166
-
167
- Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
168
-
169
- 15. Disclaimer of Warranty.
170
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
171
-
172
- 16. Limitation of Liability.
173
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
174
-
175
- 17. Interpretation of Sections 15 and 16.
176
- If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
177
-
178
- END OF TERMS AND CONDITIONS
179
-
180
- How to Apply These Terms to Your New Programs
181
- If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
182
-
183
- To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
184
-
185
- <one line to give the program's name and a brief idea of what it does.>
186
- Copyright (C) <year> <name of author>
187
-
188
- This program is free software: you can redistribute it and/or modify
189
- it under the terms of the GNU General Public License as published by
190
- the Free Software Foundation, either version 3 of the License, or
191
- (at your option) any later version.
192
-
193
- This program is distributed in the hope that it will be useful,
194
- but WITHOUT ANY WARRANTY; without even the implied warranty of
195
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
196
- GNU General Public License for more details.
197
-
198
- You should have received a copy of the GNU General Public License
199
- along with this program. If not, see <https://www.gnu.org/licenses/>.
200
- Also add information on how to contact you by electronic and paper mail.
201
-
202
- If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
203
-
204
- <program> Copyright (C) <year> <name of author>
205
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
206
- This is free software, and you are welcome to redistribute it
207
- under certain conditions; type `show c' for details.
208
- The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
209
-
210
- You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
211
-
212
- The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/licenses/why-not-lgpl.html>.
213
- """
214
-
215
-
216
-
217
- # GNU_LICENSE_DOC = "The GNU General Public License is a free, copyleft license for software and other kinds of works. \
218
- # \
219
- # The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. \
220
- # \
221
- # When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. \
222
- # \
223
- # To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. \
224
- # \
225
- # For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. \
226
- # \
227
- # Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. \
228
- # \
229
- # For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. \
230
- # \
231
- # Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. \
232
- # \
233
- # Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free."
234
-
235
- GPL_LICENSE_QUESTION = "what does the document say about distributing programs using GPL license?"
236
-
237
- POKEMON_GO_TERMS_OF_SERVICE = " welcome to the pokémon go video game services which are accessible via the niantic inc niantic mobile device application. This section of the license describes who is eligible to use the services. Unless stated otherwise for a particular Service, children are not allowed to use the Services. A “Child“ is a person (a) under 13 years old (for residents outside of the EEA, except for the Republic of Korea); (b) under 16 years old or such age needed to consent to the processing of personal data in their country of residence (for residents of the EEA); or (c) under 14 years old (for residents of the Republic of Korea). Niantic Game and App Resources contains information on the age requirement for each of our Apps. \
238
- \
239
- For Services that permit Child participation, parents or legal guardians (“Parents“) must provide verified consent. Parents can provide and verify their consent through the Niantic Kids Parent Portal, or through another authorized third-party provider made available through the Service. Where Parental consent is required, Niantic recommends that Parents monitor the Child’s online activity and use of the Service. \
240
- \
241
- The verification and consent process for Children is performed by one of several third-party providers (“Verification Provider“). The Parent must register with the Verification Provider before a Child may use the Services. The Verification Provider will ask the Parent to verify their identity and to consent to the creation of an Account for the Child. Upon receipt of Parent verification and consent, the Verification Provider will enable the Parent to create an Account for the Child. Parental consent applies exclusively to the Service for which it has been granted. \
242
- \
243
- A Parent who wishes to rescind their previously-provided consent to a Child’s access to and use of the Services should follow the instructions for Account deletion, which can be found in the respective help centers here. \
244
- \
245
- Purchases made through the Services are limited to Account holders who either (a) are the age needed to consent to a contract in their country of residence; or (b) if younger, have the consent of a Parent to use the Service. Parents can consult their device settings for the App to restrict in-App purchases by a Child, and should also monitor activity in their Child’s Account, including the purchase of Virtual Money or Virtual Goods. \
246
- \
247
- TO THE EXTENT PERMITTED UNDER APPLICABLE LAW, NIANTIC DECLINES ANY RESPONSIBILITY REGARDING ANY ACTIVITIES CONDUCTED BY A CHILD WITH OR WITHOUT THE PERMISSION OF A PARENT. IF YOU ARE A PARENT AND YOU GIVE YOUR PERMISSION FOR YOUR CHILD TO REGISTER FOR ONE OF THE SERVICES, YOU THEREBY AGREE TO THE TERMS RELATING TO USE OF THE SERVICES BY YOUR CHILD."
248
-
249
- POKEMON_GO_QUESTION = "If I am below 13 years old, can I play this game?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
base/.ipynb_checkpoints/legal_document_utils-checkpoint.py DELETED
@@ -1,80 +0,0 @@
1
- import os, cohere
2
- from langchain.embeddings.cohere import CohereEmbeddings
3
- from langchain.llms import Cohere
4
- from langchain.prompts import PromptTemplate
5
- from langchain.vectorstores import Qdrant
6
- from langchain.text_splitter import CharacterTextSplitter
7
- from langchain.chains.question_answering import load_qa_chain
8
- import pandas as pd
9
-
10
- # load environment variables
11
- QDRANT_HOST = os.environ.get("QDRANT_HOST")
12
- QDRANT_API_KEY = os.environ.get("QDRANT_API_KEY")
13
- COHERE_API_KEY = os.environ.get("COHERE_API_KEY")
14
-
15
- # define constants
16
- SUMMARIZATION_MODEL = "summarize-xlarge"
17
-
18
-
19
- def summarize(
20
- document: str,
21
- summary_length: str,
22
- summary_format: str,
23
- extractiveness: str,
24
- temperature: float,
25
- ):
26
-
27
- summary_response = cohere.Client(COHERE_API_KEY).summarize(
28
- text=document,
29
- length=summary_length,
30
- format=summary_format,
31
- model=SUMMARIZATION_MODEL,
32
- extractiveness=extractiveness,
33
- temperature=temperature,
34
- )
35
- return summary_response.summary
36
-
37
-
38
- def question_answer(input_document, history):
39
- context = input_document
40
- question = history[-1][0]
41
-
42
- texts = [context[k : k + 256] for k in range(0, len(context.split()), 256)]
43
-
44
- embeddings = CohereEmbeddings(
45
- model="multilingual-22-12", cohere_api_key=COHERE_API_KEY
46
- )
47
- context_index = Qdrant.from_texts(
48
- texts, embeddings, host=QDRANT_HOST, api_key=QDRANT_API_KEY
49
- )
50
-
51
- prompt_template = """Text: {context}
52
-
53
- Question: {question}
54
-
55
- Answer the question based on the text provided. If the text doesn't contain the answer, reply that the answer is not available."""
56
-
57
- PROMPT = PromptTemplate(
58
- template=prompt_template, input_variables=["context", "question"]
59
- )
60
-
61
- # Generate the answer given the context
62
- chain = load_qa_chain(
63
- Cohere(
64
- model="command-xlarge-nightly", temperature=0, cohere_api_key=COHERE_API_KEY
65
- ),
66
- chain_type="stuff",
67
- prompt=PROMPT,
68
- )
69
- relevant_context = context_index.similarity_search(question)
70
- answer = chain.run(input_documents=relevant_context, question=question)
71
- answer = answer.replace("\n", "").replace("Answer:", "")
72
- return answer
73
-
74
- def load_gpl_license():
75
- df = pd.read_csv("app/examples.csv")
76
- return df['doc'].iloc[0], df['question'].iloc[0]
77
-
78
- def load_pokemon_license():
79
- df = pd.read_csv("app/examples.csv")
80
- return df['doc'].iloc[1], df['question'].iloc[1]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
base/.ipynb_checkpoints/qdrant_cohere_utils-checkpoint.py DELETED
@@ -1,191 +0,0 @@
1
- import os
2
- import cohere
3
- from qdrant_client import QdrantClient
4
- from qdrant_client import models
5
- from qdrant_client.http import models as rest
6
-
7
- # load environment variables
8
- QDRANT_HOST = os.environ.get("QDRANT_HOST")
9
- QDRANT_API_KEY = os.environ.get("QDRANT_API_KEY")
10
- COHERE_API_KEY = os.environ.get("COHERE_API_KEY")
11
-
12
- vector_size = 768
13
- MLLM_MODEL = "multilingual-22-12"
14
-
15
- cohere_client = cohere.Client(COHERE_API_KEY)
16
-
17
- qdrant_client = QdrantClient(
18
- host=QDRANT_HOST,
19
- prefer_grpc=True,
20
- api_key=QDRANT_API_KEY,
21
- )
22
-
23
-
24
- def get_qdrant_collection_name(user_input: str):
25
- if user_input == "terms of service":
26
- collection_name = "legal_qa"
27
- elif user_input == "caselaw":
28
- collection_name = "caselaws"
29
- elif user_input == "legislation":
30
- collection_name = "legislations"
31
- elif user_input == "contracts":
32
- collection_name = "multilingual_legal_contracts"
33
- return collection_name
34
-
35
-
36
- def get_embedding_size(model_name: str):
37
- if model_name == "large":
38
- embedding_size = 4096
39
- elif model_name == MLLM_MODEL:
40
- embedding_size = 768
41
- return embedding_size
42
-
43
-
44
- def create_qdrant_collection(vector_size):
45
- qdrant_client.recreate_collection(
46
- collection_name=collection_name,
47
- vectors_config=models.VectorParams(
48
- size=vector_size, distance=rest.Distance.DOT
49
- ),
50
- )
51
-
52
-
53
- def embed_legal_docs(cohere_client, legal_docs):
54
- legal_docs_embeds = cohere_client.embed(
55
- texts=legal_docs,
56
- model="multilingual-22-12",
57
- )
58
- doc_embeddings = [
59
- list(map(float, vector)) for vector in legal_docs_embeds.embeddings
60
- ]
61
- doc_ids = [id for id, entry in enumerate(legal_docs_embeds)]
62
- return doc_embeddings, doc_ids
63
-
64
-
65
- def embed_user_query(user_query):
66
- embeddings = cohere_client.embed(
67
- texts=[user_query],
68
- model=MLLM_MODEL,
69
- )
70
- return embeddings
71
-
72
-
73
- def upsert_data_in_collection(qdrant_client, vectors, ids, payload):
74
- qdrant_client.upsert(
75
- collection_name=collection_name,
76
- points=rest.Batch(
77
- ids=ids,
78
- vectors=vectors,
79
- payloads=payload,
80
- ),
81
- )
82
-
83
-
84
- def search_docs_for_query(
85
- qdrant_client,
86
- query_embedding,
87
- num_results,
88
- user_query,
89
- languages,
90
- doc_type,
91
- match_language,
92
- ):
93
- filters = []
94
- collection_name = "covid19"
95
-
96
- language_mapping = {
97
- "Dutch": "nl",
98
- "English": "en",
99
- "French": "fr",
100
- "Hungarian": "hu",
101
- "Italian": "it",
102
- "Norwegian": "nb",
103
- "Polish": "pl",
104
- }
105
-
106
- if match_language:
107
- filters.append(
108
- models.FieldCondition(
109
- key="text",
110
- match=models.MatchText(text=user_query),
111
- )
112
- )
113
-
114
- # if match_language:
115
- if languages:
116
- for lang in languages:
117
- filters.append(
118
- models.FieldCondition(
119
- key="language",
120
- match=models.MatchValue(
121
- value=language_mapping[lang],
122
- ),
123
- )
124
- )
125
-
126
- result = qdrant_client.search(
127
- collection_name=collection_name,
128
- query_filter=models.Filter(should=filters),
129
- search_params=models.SearchParams(hnsw_ef=128, exact=False),
130
- query_vector=query_embedding,
131
- limit=num_results,
132
- )
133
- return result
134
-
135
-
136
- def translate_output(input_sentence, user_query):
137
- response = cohere_client.tokenize(text=input_sentence)
138
-
139
- src_detected_lang = cohere_client.detect_language(texts=[input_sentence])
140
- src_current_lang = src_detected_lang.results[0].language_name
141
- print("src_current_lang:", src_current_lang)
142
-
143
- # target_detected_lang = cohere_client.detect_language(texts=[user_query])
144
- # target_current_lang = target_detected_lang.results[0].language_name
145
-
146
- target_current_lang = "English"
147
- if src_current_lang == "English":
148
- return input_sentence
149
-
150
- prompt = f""""
151
- Translate this sentence from {src_detected_lang} to {target_current_lang}: '{input_sentence}'.
152
-
153
- Don't include the above prompt in the final translation. The final output should only include the translation of the input sentence.
154
- """
155
-
156
- response = cohere_client.generate(
157
- model="command-xlarge-nightly",
158
- prompt=prompt,
159
- max_tokens=len(response.tokens) * 3,
160
- temperature=0.6,
161
- stop_sequences=["--"],
162
- )
163
-
164
- translation = response.generations[0].text
165
- print("translation:",translation)
166
- return translation
167
-
168
-
169
- def cross_lingual_document_search(
170
- user_input: str, num_results: int, languages, doc_type, text_match
171
- ):
172
- query_embed = embed_user_query(user_input)
173
- query_embedding = query_embed.embeddings[0]
174
-
175
- result = search_docs_for_query(
176
- qdrant_client,
177
- query_embedding,
178
- num_results,
179
- user_input,
180
- languages,
181
- doc_type,
182
- text_match,
183
- )
184
- final_results = [result[i].payload["text"] for i in range(len(result))]
185
-
186
- if num_results > len(final_results):
187
- remaining_inputs = num_results - len(final_results)
188
- for i in range(remaining_inputs):
189
- final_results.append("")
190
-
191
- return final_results
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
base/__pycache__/examples.cpython-39.pyc DELETED
Binary file (37.5 kB)
 
base/__pycache__/legal_document_utils.cpython-39.pyc DELETED
Binary file (2.6 kB)
 
base/__pycache__/qdrant_cohere_utils.cpython-39.pyc DELETED
Binary file (4.59 kB)
 
base/constants.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # name of cohere's summarization model
2
+ SUMMARIZATION_MODEL = "summarize-xlarge"
3
+
4
+ # path of the csv file containing the example legal documents
5
+ EXAMPLES_FILE_PATH = "base/examples.csv"
6
+
7
+ # whether to use multilingual embeddings to represent the documents or not
8
+ USE_MULTILINGUAL_EMBEDDING = True
9
+
10
+ # name of cohere's multilingual embedding model
11
+ MULTILINGUAL_EMBEDDING_MODEL = "multilingual-22-12"
12
+
13
+ # name of cohere's default embedding model
14
+ ENGLISH_EMBEDDING_MODEL = "large"
15
+
16
+ # The name with which you want to create a collection in Qdrant
17
+ CREATE_QDRANT_COLLECTION_NAME = "covid19"
18
+
19
+ # name of cohere's model which will be used for generating the translation of an input document
20
+ TEXT_GENERATION_MODEL = "command-xlarge-nightly"
21
+
22
+ # whether the search results obtained via document search module should be translated into the language which was used by the user to type their `search query`.
23
+ TRANSLATE_BASED_ON_USER_QUERY = False
24
+
25
+ # If you have multiple collections inside your Qdrant DB, make sure the value of this variable is set to the name of the collection on which you want to enable search.
26
+ SEARCH_QDRANT_COLLECTION_NAME = "covid19"
base/create_collection.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Run this script independently (`python create_collection.py`) to create a Qdrant collection. A Qdrant collection is a set of vectors among which you can search.
2
+ # All the legal documents over which search needs to be enabled need to be converted to their embedding representation and inserted into a Qdrant collection for search feature to work.
3
+
4
+ import os
5
+ import cohere
6
+ from datasets import load_dataset
7
+ from qdrant_client import QdrantClient
8
+ from qdrant_client import models
9
+ from qdrant_client.http import models as rest
10
+
11
+ from constants import (
12
+ ENGLISH_EMBEDDING_MODEL,
13
+ MULTILINGUAL_EMBEDDING_MODEL,
14
+ USE_MULTILINGUAL_EMBEDDING,
15
+ CREATE_QDRANT_COLLECTION_NAME,
16
+ )
17
+
18
+ # load environment variables
19
+ QDRANT_HOST = os.environ.get("QDRANT_HOST")
20
+ QDRANT_API_KEY = os.environ.get("QDRANT_API_KEY")
21
+ COHERE_API_KEY = os.environ.get("COHERE_API_KEY")
22
+
23
+
24
+ def get_embedding_size():
25
+ """
26
+ Get the dimensions of the embeddings returned by the model being used to create embeddings for documents.
27
+ Returns:
28
+ embedding_size (`int`):
29
+ The dimensions of the embeddings returned by the embeddings model.
30
+ """
31
+ if USE_MULTILINGUAL_EMBEDDING:
32
+ embedding_size = 768
33
+ else:
34
+ embedding_size = 4096
35
+ return embedding_size
36
+
37
+
38
+ def create_qdrant_collection(vector_size):
39
+ """
40
+ (Re)-create a Qdrant Collection with the desired `collection name` , `vector_size` and `distance_measure`.
41
+ This collection will be used to keep all the vectors representing all the legal documents.
42
+ Args:
43
+ vector_size (`int`):
44
+ The dimensions of the embeddings that will be added to the collection.
45
+ """
46
+ if USE_MULTILINGUAL_EMBEDDING:
47
+ # multilingual embedding model trained using dot product calculation
48
+ distance_measure = rest.Distance.DOT
49
+ else:
50
+ distance_measure = rest.Distance.COSINE
51
+ print("CREATE_QDRANT_COLLECTION_NAME:", CREATE_QDRANT_COLLECTION_NAME)
52
+ qdrant_client.recreate_collection(
53
+ collection_name=CREATE_QDRANT_COLLECTION_NAME,
54
+ vectors_config=models.VectorParams(size=vector_size, distance=distance_measure),
55
+ )
56
+
57
+
58
+ def embed_legal_docs(legal_docs):
59
+ """
60
+ Create embeddings and ids which will used to represent the legal documents upon which search needs to be enabled.
61
+ Args:
62
+ legal_docs (`List`):
63
+ A list of documents for which embeddings need to be created.
64
+ Returns:
65
+ doc_embeddings (`List`):
66
+ A list of embeddings corresponding to each document.
67
+ doc_ids (`List`):
68
+ A list of unique ids which will be used as identifiers for the points (documents) in a qdrant collection.
69
+ """
70
+ if USE_MULTILINGUAL_EMBEDDING:
71
+ model_name = MULTILINGUAL_EMBEDDING_MODEL
72
+ else:
73
+ model_name = ENGLISH_EMBEDDING_MODEL
74
+
75
+ legal_docs_embeds = cohere_client.embed(
76
+ texts=legal_docs,
77
+ model=model_name,
78
+ )
79
+ doc_embeddings = [
80
+ list(map(float, vector)) for vector in legal_docs_embeds.embeddings
81
+ ]
82
+ doc_ids = [id for id, _ in enumerate(legal_docs_embeds)]
83
+
84
+ return doc_embeddings, doc_ids
85
+
86
+
87
+ def upsert_data_in_collection(vectors, ids, payload):
88
+ """
89
+ Create embeddings and ids which will used to represent the legal documents upon which search needs to be enabled.
90
+ Args:
91
+ vectors (`List`):
92
+ A list of embeddings corresponding to each document which needs to be added to the collection.
93
+ ids (`List`):
94
+ A list of unique ids which will be used as identifiers for the points (documents) in a qdrant collection.
95
+ payload (`List`):
96
+ A list of additional information or metadata corresponding to each document being added to the collection.
97
+ """
98
+ try:
99
+ update_result = qdrant_client.upsert(
100
+ collection_name=CREATE_QDRANT_COLLECTION_NAME,
101
+ points=rest.Batch(
102
+ ids=ids,
103
+ vectors=vectors,
104
+ payloads=payload,
105
+ ),
106
+ )
107
+ return update_result
108
+ except:
109
+ return None
110
+
111
+
112
+ def fetch_legal_documents_and_payload():
113
+ """
114
+ Get the legal documents and additional information (payload) related to them which will be used as part of the search module.
115
+ Returns:
116
+ legal_docs (`List['str]`):
117
+ The documents that will be used as part of the search module.
118
+ payload (`List[Dict]`):
119
+ Additional information related to the documents that are being used as part of the search module.
120
+ """
121
+ legal_dataset = load_dataset("joelito/covid19_emergency_event", split="train")
122
+ legal_docs = legal_dataset["text"]
123
+
124
+ # prepare payload (additional information or metadata for documents being inserted)
125
+ payload = list(legal_dataset)
126
+
127
+ return payload, legal_docs
128
+
129
+
130
+ if __name__ == "__main__":
131
+ # create qdrant and cohere client
132
+ cohere_client = cohere.Client(COHERE_API_KEY)
133
+
134
+ qdrant_client = QdrantClient(
135
+ host=QDRANT_HOST,
136
+ prefer_grpc=True,
137
+ api_key=QDRANT_API_KEY,
138
+ )
139
+
140
+ # fetch the size of the embeddings depending on which model is being used to create embeddings for documents
141
+ vector_size = get_embedding_size()
142
+
143
+ # create a collection in Qdrant
144
+ create_qdrant_collection(vector_size)
145
+
146
+ # load the set of documents which will be inserted into the Qdrant collection
147
+ payload, legal_docs = fetch_legal_documents_and_payload()
148
+
149
+ # create embedddings for documents and IDs for documents before insertion into Qdrant collection
150
+ doc_embeddings, doc_ids = embed_legal_docs(legal_docs)
151
+
152
+ # insert/update documents in the previously created qdrant collection
153
+ update_result = upsert_data_in_collection(doc_embeddings, doc_ids, payload)
154
+
155
+ collection_info = qdrant_client.get_collection(
156
+ collection_name=CREATE_QDRANT_COLLECTION_NAME
157
+ )
158
+
159
+ if update_result is not None:
160
+ if collection_info.vectors_count == len(legal_docs):
161
+ print("All documents have been successfully added to Qdrant Collection!")
162
+ else:
163
+ print("Failed to add documents to Qdrant collection")
base/{qdrant_cohere_utils.py → document_search.py} RENAMED
@@ -1,97 +1,85 @@
1
  import os
2
  import cohere
 
3
  from qdrant_client import QdrantClient
4
  from qdrant_client import models
5
- from qdrant_client.http import models as rest
 
 
 
 
 
 
 
 
6
 
7
  # load environment variables
8
  QDRANT_HOST = os.environ.get("QDRANT_HOST")
9
  QDRANT_API_KEY = os.environ.get("QDRANT_API_KEY")
10
  COHERE_API_KEY = os.environ.get("COHERE_API_KEY")
11
 
12
- vector_size = 768
13
- MLLM_MODEL = "multilingual-22-12"
14
-
15
  cohere_client = cohere.Client(COHERE_API_KEY)
16
 
17
  qdrant_client = QdrantClient(
18
  host=QDRANT_HOST,
19
- prefer_grpc=True,
20
  api_key=QDRANT_API_KEY,
 
21
  )
22
 
23
 
24
- def get_qdrant_collection_name(user_input: str):
25
- if user_input == "terms of service":
26
- collection_name = "legal_qa"
27
- elif user_input == "caselaw":
28
- collection_name = "caselaws"
29
- elif user_input == "legislation":
30
- collection_name = "legislations"
31
- elif user_input == "contracts":
32
- collection_name = "multilingual_legal_contracts"
33
- return collection_name
34
-
35
-
36
- def get_embedding_size(model_name: str):
37
- if model_name == "large":
38
- embedding_size = 4096
39
- elif model_name == MLLM_MODEL:
40
- embedding_size = 768
41
- return embedding_size
42
-
43
-
44
- def create_qdrant_collection(vector_size):
45
- qdrant_client.recreate_collection(
46
- collection_name=collection_name,
47
- vectors_config=models.VectorParams(
48
- size=vector_size, distance=rest.Distance.DOT
49
- ),
50
- )
51
-
52
 
53
- def embed_legal_docs(cohere_client, legal_docs):
54
- legal_docs_embeds = cohere_client.embed(
55
- texts=legal_docs,
56
- model="multilingual-22-12",
57
- )
58
- doc_embeddings = [
59
- list(map(float, vector)) for vector in legal_docs_embeds.embeddings
60
- ]
61
- doc_ids = [id for id, entry in enumerate(legal_docs_embeds)]
62
- return doc_embeddings, doc_ids
63
 
 
 
 
 
 
 
 
 
64
 
65
- def embed_user_query(user_query):
66
  embeddings = cohere_client.embed(
67
  texts=[user_query],
68
- model=MLLM_MODEL,
69
- )
70
- return embeddings
71
-
72
-
73
- def upsert_data_in_collection(qdrant_client, vectors, ids, payload):
74
- qdrant_client.upsert(
75
- collection_name=collection_name,
76
- points=rest.Batch(
77
- ids=ids,
78
- vectors=vectors,
79
- payloads=payload,
80
- ),
81
  )
 
 
82
 
83
 
84
  def search_docs_for_query(
85
- qdrant_client,
86
- query_embedding,
87
- num_results,
88
- user_query,
89
- languages,
90
- doc_type,
91
- match_language,
92
- ):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  filters = []
94
- collection_name = "covid19"
95
 
96
  language_mapping = {
97
  "Dutch": "nl",
@@ -103,7 +91,10 @@ def search_docs_for_query(
103
  "Polish": "pl",
104
  }
105
 
106
- if match_language:
 
 
 
107
  filters.append(
108
  models.FieldCondition(
109
  key="text",
@@ -111,7 +102,7 @@ def search_docs_for_query(
111
  )
112
  )
113
 
114
- # if match_language:
115
  if languages:
116
  for lang in languages:
117
  filters.append(
@@ -122,39 +113,53 @@ def search_docs_for_query(
122
  ),
123
  )
124
  )
125
-
126
- result = qdrant_client.search(
127
- collection_name=collection_name,
 
128
  query_filter=models.Filter(should=filters),
129
  search_params=models.SearchParams(hnsw_ef=128, exact=False),
130
  query_vector=query_embedding,
131
  limit=num_results,
132
  )
133
- return result
134
 
135
 
136
- def translate_output(input_sentence, user_query):
 
 
 
 
 
 
 
 
 
 
 
 
137
  response = cohere_client.tokenize(text=input_sentence)
138
-
139
  src_detected_lang = cohere_client.detect_language(texts=[input_sentence])
140
  src_current_lang = src_detected_lang.results[0].language_name
141
- print("src_current_lang:", src_current_lang)
142
-
143
- # target_detected_lang = cohere_client.detect_language(texts=[user_query])
144
- # target_current_lang = target_detected_lang.results[0].language_name
145
-
146
- target_current_lang = "English"
147
- if src_current_lang == "English":
 
148
  return input_sentence
149
-
150
  prompt = f""""
151
- Translate this sentence from {src_detected_lang} to {target_current_lang}: '{input_sentence}'.
152
 
153
  Don't include the above prompt in the final translation. The final output should only include the translation of the input sentence.
154
  """
155
 
156
  response = cohere_client.generate(
157
- model="command-xlarge-nightly",
158
  prompt=prompt,
159
  max_tokens=len(response.tokens) * 3,
160
  temperature=0.6,
@@ -162,30 +167,46 @@ def translate_output(input_sentence, user_query):
162
  )
163
 
164
  translation = response.generations[0].text
165
- print("translation:",translation)
166
  return translation
167
 
168
 
169
  def cross_lingual_document_search(
170
- user_input: str, num_results: int, languages, doc_type, text_match
171
- ):
172
- query_embed = embed_user_query(user_input)
173
- query_embedding = query_embed.embeddings[0]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
 
 
175
  result = search_docs_for_query(
176
- qdrant_client,
177
  query_embedding,
178
  num_results,
179
  user_input,
180
  languages,
181
- doc_type,
182
  text_match,
183
  )
184
  final_results = [result[i].payload["text"] for i in range(len(result))]
185
 
 
186
  if num_results > len(final_results):
187
  remaining_inputs = num_results - len(final_results)
188
- for i in range(remaining_inputs):
189
  final_results.append("")
190
 
191
  return final_results
 
1
  import os
2
  import cohere
3
+ from typing import List
4
  from qdrant_client import QdrantClient
5
  from qdrant_client import models
6
+
7
+ from .constants import (
8
+ MULTILINGUAL_EMBEDDING_MODEL,
9
+ ENGLISH_EMBEDDING_MODEL,
10
+ SEARCH_QDRANT_COLLECTION_NAME,
11
+ TRANSLATE_BASED_ON_USER_QUERY,
12
+ TEXT_GENERATION_MODEL,
13
+ USE_MULTILINGUAL_EMBEDDING,
14
+ )
15
 
16
  # load environment variables
17
  QDRANT_HOST = os.environ.get("QDRANT_HOST")
18
  QDRANT_API_KEY = os.environ.get("QDRANT_API_KEY")
19
  COHERE_API_KEY = os.environ.get("COHERE_API_KEY")
20
 
21
+ # create qdrant and cohere client
 
 
22
  cohere_client = cohere.Client(COHERE_API_KEY)
23
 
24
  qdrant_client = QdrantClient(
25
  host=QDRANT_HOST,
26
+ prefer_grpc=False,
27
  api_key=QDRANT_API_KEY,
28
+ port=443,
29
  )
30
 
31
 
32
+ def embed_user_query(user_query: str) -> List:
33
+ """
34
+ Create an embedding for the given query by the user using Cohere's Embed API.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
+ Args:
37
+ user_query (`str`):
38
+ The input query by the user based on which search will be performed with the help of Qdrant.
 
 
 
 
 
 
 
39
 
40
+ Returns:
41
+ query_embedding (`List`):
42
+ A list of numbers or vector representing the user query.
43
+ """
44
+ if USE_MULTILINGUAL_EMBEDDING:
45
+ model_name = MULTILINGUAL_EMBEDDING_MODEL
46
+ else:
47
+ model_name = ENGLISH_EMBEDDING_MODEL
48
 
 
49
  embeddings = cohere_client.embed(
50
  texts=[user_query],
51
+ model=model_name,
 
 
 
 
 
 
 
 
 
 
 
 
52
  )
53
+ query_embedding = embeddings.embeddings[0]
54
+ return query_embedding
55
 
56
 
57
  def search_docs_for_query(
58
+ query_embedding: List,
59
+ num_results: int,
60
+ user_query: str,
61
+ languages: List,
62
+ match_text: List,
63
+ ) -> List:
64
+ """
65
+ Perform search on the collection of documents for the given user query using Qdrant's search API.
66
+ Args:
67
+ query_embedding (`List`):
68
+ A vector representing the user query.
69
+ num_results (`str`):
70
+ The number of expected search results.
71
+ user_query (`str`):
72
+ The user input based on which search will be performed.
73
+ languages (`str`):
74
+ The list of languages based on which search results must be filtered.
75
+ match_text (`List`):
76
+ A field based on which it is decided whether to perform full-text-match while performing search.
77
+ Returns:
78
+ results (`List[ScoredPoint]`):
79
+ A list of `ScoredPoint` objects returned via Qdrant's search API.
80
+ """
81
+
82
  filters = []
 
83
 
84
  language_mapping = {
85
  "Dutch": "nl",
 
91
  "Polish": "pl",
92
  }
93
 
94
+ # prepare filters to narrow down search results
95
+
96
+ # if the `match_text` list is not empty then create filter to find exact matching text in the documents
97
+ if match_text:
98
  filters.append(
99
  models.FieldCondition(
100
  key="text",
 
102
  )
103
  )
104
 
105
+ # filter documents based on language before performing search:
106
  if languages:
107
  for lang in languages:
108
  filters.append(
 
113
  ),
114
  )
115
  )
116
+
117
+ # perform search and get results
118
+ results = qdrant_client.search(
119
+ collection_name=SEARCH_QDRANT_COLLECTION_NAME,
120
  query_filter=models.Filter(should=filters),
121
  search_params=models.SearchParams(hnsw_ef=128, exact=False),
122
  query_vector=query_embedding,
123
  limit=num_results,
124
  )
125
+ return results
126
 
127
 
128
+ def translate_search_result(input_sentence, user_query):
129
+ """
130
+ Translate a given input sentence to the required target language. The required target language is `English` by default.
131
+ The target language can be changed to match the language that the user used to type his search query by setting the `TRANSLATE_BASED_ON_USER_QUERY` to `True`.
132
+ Args:
133
+ input_sentence (`str`):
134
+ The sentence which needs to be translated into the required target language.
135
+ user_query (`str`):
136
+ The user input based on which the target language for translation will be determined if `TRANSLATE_BASED_ON_USER_QUERY` is set to `True`.
137
+ Returns:
138
+ translation (`str`):
139
+ The final translation result obtained using Cohere's Generate API.
140
+ """
141
  response = cohere_client.tokenize(text=input_sentence)
142
+
143
  src_detected_lang = cohere_client.detect_language(texts=[input_sentence])
144
  src_current_lang = src_detected_lang.results[0].language_name
145
+
146
+ if TRANSLATE_BASED_ON_USER_QUERY:
147
+ target_detected_lang = cohere_client.detect_language(texts=[user_query])
148
+ target_current_lang = target_detected_lang.results[0].language_name
149
+ else:
150
+ target_current_lang = "English"
151
+
152
+ if target_current_lang == src_current_lang:
153
  return input_sentence
154
+
155
  prompt = f""""
156
+ Translate this sentence from {src_current_lang} to {target_current_lang}: '{input_sentence}'.
157
 
158
  Don't include the above prompt in the final translation. The final output should only include the translation of the input sentence.
159
  """
160
 
161
  response = cohere_client.generate(
162
+ model=TEXT_GENERATION_MODEL,
163
  prompt=prompt,
164
  max_tokens=len(response.tokens) * 3,
165
  temperature=0.6,
 
167
  )
168
 
169
  translation = response.generations[0].text
170
+
171
  return translation
172
 
173
 
174
  def cross_lingual_document_search(
175
+ user_input: str, num_results: int, languages, text_match
176
+ ) -> List:
177
+ """
178
+ Wrapper function for performing search on the collection of documents for the given user query.
179
+ Prepares query embedding, retrieves search results, checks if expected number of search results are being returned.
180
+ Args:
181
+ user_input (`str`):
182
+ The user input based on which search will be performed.
183
+ num_results (`str`):
184
+ The number of expected search results.
185
+ languages (`str`):
186
+ The list of languages based on which search results must be filtered.
187
+ text_match (`str`):
188
+ A field based on which it is decided whether to perform full-text-match while performing search.
189
+ Returns:
190
+ final_results (`List[str]`):
191
+ A list containing the final search results corresponding to the given user input.
192
+ """
193
+ # create an embedding for the input query
194
+ query_embedding = embed_user_query(user_input)
195
 
196
+ # retrieve search results
197
  result = search_docs_for_query(
 
198
  query_embedding,
199
  num_results,
200
  user_input,
201
  languages,
 
202
  text_match,
203
  )
204
  final_results = [result[i].payload["text"] for i in range(len(result))]
205
 
206
+ # check if number of search results obtained (i.e. `final_results`) is matching with number of expected search results i.e. `num_results`
207
  if num_results > len(final_results):
208
  remaining_inputs = num_results - len(final_results)
209
+ for input in range(remaining_inputs):
210
  final_results.append("")
211
 
212
  return final_results
base/examples.csv CHANGED
@@ -209,15 +209,15 @@ The hypothetical commands `show w' and `show c' should show the appropriate part
209
 
210
  You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
211
 
212
- The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/licenses/why-not-lgpl.html>.",what does the document say about distributing programs using GPL license?
213
- 2,"welcome to the pokémon go video game services which are accessible via the niantic inc niantic mobile device application. This section of the license describes who is eligible to use the services. Unless stated otherwise for a particular Service, children are not allowed to use the Services. A “Child“ is a person (a) under 13 years old (for residents outside of the EEA, except for the Republic of Korea); (b) under 16 years old or such age needed to consent to the processing of personal data in their country of residence (for residents of the EEA); or (c) under 14 years old (for residents of the Republic of Korea). Niantic Game and App Resources contains information on the age requirement for each of our Apps. \
214
- \
215
- For Services that permit Child participation, parents or legal guardians (“Parents“) must provide verified consent. Parents can provide and verify their consent through the Niantic Kids Parent Portal, or through another authorized third-party provider made available through the Service. Where Parental consent is required, Niantic recommends that Parents monitor the Child’s online activity and use of the Service. \
216
- \
217
- The verification and consent process for Children is performed by one of several third-party providers (“Verification Provider“). The Parent must register with the Verification Provider before a Child may use the Services. The Verification Provider will ask the Parent to verify their identity and to consent to the creation of an Account for the Child. Upon receipt of Parent verification and consent, the Verification Provider will enable the Parent to create an Account for the Child. Parental consent applies exclusively to the Service for which it has been granted. \
218
- \
219
- A Parent who wishes to rescind their previously-provided consent to a Child’s access to and use of the Services should follow the instructions for Account deletion, which can be found in the respective help centers here. \
220
- \
221
- Purchases made through the Services are limited to Account holders who either (a) are the age needed to consent to a contract in their country of residence; or (b) if younger, have the consent of a Parent to use the Service. Parents can consult their device settings for the App to restrict in-App purchases by a Child, and should also monitor activity in their Child’s Account, including the purchase of Virtual Money or Virtual Goods. \
222
- \
223
  TO THE EXTENT PERMITTED UNDER APPLICABLE LAW, NIANTIC DECLINES ANY RESPONSIBILITY REGARDING ANY ACTIVITIES CONDUCTED BY A CHILD WITH OR WITHOUT THE PERMISSION OF A PARENT. IF YOU ARE A PARENT AND YOU GIVE YOUR PERMISSION FOR YOUR CHILD TO REGISTER FOR ONE OF THE SERVICES, YOU THEREBY AGREE TO THE TERMS RELATING TO USE OF THE SERVICES BY YOUR CHILD.","If I am below 13 years old, can I play this game?"
 
209
 
210
  You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
211
 
212
+ The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/licenses/why-not-lgpl.html>.",Explain the terms for modification of a work according to GPL license
213
+ 2,"welcome to the pokémon go video game services which are accessible via the niantic inc niantic mobile device application. This section of the license describes who is eligible to use the services. Unless stated otherwise for a particular Service, children are not allowed to use the Services. A “Child“ is a person (a) under 13 years old (for residents outside of the EEA, except for the Republic of Korea); (b) under 16 years old or such age needed to consent to the processing of personal data in their country of residence (for residents of the EEA); or (c) under 14 years old (for residents of the Republic of Korea). Niantic Game and App Resources contains information on the age requirement for each of our Apps.
214
+
215
+ For Services that permit Child participation, parents or legal guardians (“Parents“) must provide verified consent. Parents can provide and verify their consent through the Niantic Kids Parent Portal, or through another authorized third-party provider made available through the Service. Where Parental consent is required, Niantic recommends that Parents monitor the Child’s online activity and use of the Service.
216
+
217
+ The verification and consent process for Children is performed by one of several third-party providers (“Verification Provider“). The Parent must register with the Verification Provider before a Child may use the Services. The Verification Provider will ask the Parent to verify their identity and to consent to the creation of an Account for the Child. Upon receipt of Parent verification and consent, the Verification Provider will enable the Parent to create an Account for the Child. Parental consent applies exclusively to the Service for which it has been granted.
218
+
219
+ A Parent who wishes to rescind their previously-provided consent to a Child’s access to and use of the Services should follow the instructions for Account deletion, which can be found in the respective help centers here.
220
+
221
+ Purchases made through the Services are limited to Account holders who either (a) are the age needed to consent to a contract in their country of residence; or (b) if younger, have the consent of a Parent to use the Service. Parents can consult their device settings for the App to restrict in-App purchases by a Child, and should also monitor activity in their Child’s Account, including the purchase of Virtual Money or Virtual Goods.
222
+
223
  TO THE EXTENT PERMITTED UNDER APPLICABLE LAW, NIANTIC DECLINES ANY RESPONSIBILITY REGARDING ANY ACTIVITIES CONDUCTED BY A CHILD WITH OR WITHOUT THE PERMISSION OF A PARENT. IF YOU ARE A PARENT AND YOU GIVE YOUR PERMISSION FOR YOUR CHILD TO REGISTER FOR ONE OF THE SERVICES, YOU THEREBY AGREE TO THE TERMS RELATING TO USE OF THE SERVICES BY YOUR CHILD.","If I am below 13 years old, can I play this game?"
base/examples.py DELETED
@@ -1,249 +0,0 @@
1
- GPL_LICENSE_DOC = """
2
- The GNU General Public License is a free, copyleft license for software and other kinds of works.
3
-
4
- The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
5
-
6
- When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
7
-
8
- To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
9
-
10
- For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
11
-
12
- Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
13
-
14
- For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
15
-
16
- Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
17
-
18
- Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
19
-
20
- The precise terms and conditions for copying, distribution and modification follow.
21
-
22
- TERMS AND CONDITIONS
23
- 0. Definitions.
24
- “This License” refers to version 3 of the GNU General Public License.
25
-
26
- “Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
27
-
28
- “The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
29
-
30
- To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
31
-
32
- A “covered work” means either the unmodified Program or a work based on the Program.
33
-
34
- To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
35
-
36
- To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
37
-
38
- An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
39
-
40
- 1. Source Code.
41
- The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
42
-
43
- A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
44
-
45
- The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
46
-
47
- The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
48
-
49
- The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
50
-
51
- The Corresponding Source for a work in source code form is that same work.
52
-
53
- 2. Basic Permissions.
54
- All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
55
-
56
- You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
57
-
58
- Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
59
-
60
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
61
- No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
62
-
63
- When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
64
-
65
- 4. Conveying Verbatim Copies.
66
- You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
67
-
68
- You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
69
-
70
- 5. Conveying Modified Source Versions.
71
- You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
72
-
73
- a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
74
- b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
75
- c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
76
- d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
77
- A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
78
-
79
- 6. Conveying Non-Source Forms.
80
- You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
81
-
82
- a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
83
- b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
84
- c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
85
- d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
86
- e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
87
- A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
88
-
89
- A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
90
-
91
- “Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
92
-
93
- If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
94
-
95
- The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
96
-
97
- Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
98
-
99
- 7. Additional Terms.
100
- “Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
101
-
102
- When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
103
-
104
- Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
105
-
106
- a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
107
- b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
108
- c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
109
- d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
110
- e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
111
- f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
112
- All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
113
-
114
- If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
115
-
116
- Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
117
-
118
- 8. Termination.
119
- You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
120
-
121
- However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
122
-
123
- Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
124
-
125
- Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
126
-
127
- 9. Acceptance Not Required for Having Copies.
128
- You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
129
-
130
- 10. Automatic Licensing of Downstream Recipients.
131
- Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
132
-
133
- An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
134
-
135
- You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
136
-
137
- 11. Patents.
138
- A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
139
-
140
- A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
141
-
142
- Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
143
-
144
- In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
145
-
146
- If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
147
-
148
- If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
149
-
150
- A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
151
-
152
- Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
153
-
154
- 12. No Surrender of Others' Freedom.
155
- If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
156
-
157
- 13. Use with the GNU Affero General Public License.
158
- Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
159
-
160
- 14. Revised Versions of this License.
161
- The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
162
-
163
- Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
164
-
165
- If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
166
-
167
- Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
168
-
169
- 15. Disclaimer of Warranty.
170
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
171
-
172
- 16. Limitation of Liability.
173
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
174
-
175
- 17. Interpretation of Sections 15 and 16.
176
- If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
177
-
178
- END OF TERMS AND CONDITIONS
179
-
180
- How to Apply These Terms to Your New Programs
181
- If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
182
-
183
- To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
184
-
185
- <one line to give the program's name and a brief idea of what it does.>
186
- Copyright (C) <year> <name of author>
187
-
188
- This program is free software: you can redistribute it and/or modify
189
- it under the terms of the GNU General Public License as published by
190
- the Free Software Foundation, either version 3 of the License, or
191
- (at your option) any later version.
192
-
193
- This program is distributed in the hope that it will be useful,
194
- but WITHOUT ANY WARRANTY; without even the implied warranty of
195
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
196
- GNU General Public License for more details.
197
-
198
- You should have received a copy of the GNU General Public License
199
- along with this program. If not, see <https://www.gnu.org/licenses/>.
200
- Also add information on how to contact you by electronic and paper mail.
201
-
202
- If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
203
-
204
- <program> Copyright (C) <year> <name of author>
205
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
206
- This is free software, and you are welcome to redistribute it
207
- under certain conditions; type `show c' for details.
208
- The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
209
-
210
- You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
211
-
212
- The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/licenses/why-not-lgpl.html>.
213
- """
214
-
215
-
216
-
217
- # GNU_LICENSE_DOC = "The GNU General Public License is a free, copyleft license for software and other kinds of works. \
218
- # \
219
- # The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. \
220
- # \
221
- # When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. \
222
- # \
223
- # To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. \
224
- # \
225
- # For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. \
226
- # \
227
- # Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. \
228
- # \
229
- # For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. \
230
- # \
231
- # Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. \
232
- # \
233
- # Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free."
234
-
235
- GPL_LICENSE_QUESTION = "what does the document say about distributing programs using GPL license?"
236
-
237
- POKEMON_GO_TERMS_OF_SERVICE = " welcome to the pokémon go video game services which are accessible via the niantic inc niantic mobile device application. This section of the license describes who is eligible to use the services. Unless stated otherwise for a particular Service, children are not allowed to use the Services. A “Child“ is a person (a) under 13 years old (for residents outside of the EEA, except for the Republic of Korea); (b) under 16 years old or such age needed to consent to the processing of personal data in their country of residence (for residents of the EEA); or (c) under 14 years old (for residents of the Republic of Korea). Niantic Game and App Resources contains information on the age requirement for each of our Apps. \
238
- \
239
- For Services that permit Child participation, parents or legal guardians (“Parents“) must provide verified consent. Parents can provide and verify their consent through the Niantic Kids Parent Portal, or through another authorized third-party provider made available through the Service. Where Parental consent is required, Niantic recommends that Parents monitor the Child’s online activity and use of the Service. \
240
- \
241
- The verification and consent process for Children is performed by one of several third-party providers (“Verification Provider“). The Parent must register with the Verification Provider before a Child may use the Services. The Verification Provider will ask the Parent to verify their identity and to consent to the creation of an Account for the Child. Upon receipt of Parent verification and consent, the Verification Provider will enable the Parent to create an Account for the Child. Parental consent applies exclusively to the Service for which it has been granted. \
242
- \
243
- A Parent who wishes to rescind their previously-provided consent to a Child’s access to and use of the Services should follow the instructions for Account deletion, which can be found in the respective help centers here. \
244
- \
245
- Purchases made through the Services are limited to Account holders who either (a) are the age needed to consent to a contract in their country of residence; or (b) if younger, have the consent of a Parent to use the Service. Parents can consult their device settings for the App to restrict in-App purchases by a Child, and should also monitor activity in their Child’s Account, including the purchase of Virtual Money or Virtual Goods. \
246
- \
247
- TO THE EXTENT PERMITTED UNDER APPLICABLE LAW, NIANTIC DECLINES ANY RESPONSIBILITY REGARDING ANY ACTIVITIES CONDUCTED BY A CHILD WITH OR WITHOUT THE PERMISSION OF A PARENT. IF YOU ARE A PARENT AND YOU GIVE YOUR PERMISSION FOR YOUR CHILD TO REGISTER FOR ONE OF THE SERVICES, YOU THEREBY AGREE TO THE TERMS RELATING TO USE OF THE SERVICES BY YOUR CHILD."
248
-
249
- POKEMON_GO_QUESTION = "If I am below 13 years old, can I play this game?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
base/legal_document_utils.py CHANGED
@@ -1,29 +1,48 @@
1
- import os, cohere
 
 
 
 
2
  from langchain.embeddings.cohere import CohereEmbeddings
3
  from langchain.llms import Cohere
4
  from langchain.prompts import PromptTemplate
5
  from langchain.vectorstores import Qdrant
6
- from langchain.text_splitter import CharacterTextSplitter
7
  from langchain.chains.question_answering import load_qa_chain
8
- import pandas as pd
 
 
9
 
10
  # load environment variables
11
  QDRANT_HOST = os.environ.get("QDRANT_HOST")
12
  QDRANT_API_KEY = os.environ.get("QDRANT_API_KEY")
13
  COHERE_API_KEY = os.environ.get("COHERE_API_KEY")
14
 
15
- # define constants
16
- SUMMARIZATION_MODEL = "summarize-xlarge"
17
-
18
 
19
  def summarize(
20
  document: str,
21
  summary_length: str,
22
  summary_format: str,
23
- extractiveness: str,
24
- temperature: float,
25
- ):
26
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  summary_response = cohere.Client(COHERE_API_KEY).summarize(
28
  text=document,
29
  length=summary_length,
@@ -32,11 +51,24 @@ def summarize(
32
  extractiveness=extractiveness,
33
  temperature=temperature,
34
  )
35
- return summary_response.summary
 
36
 
37
 
38
- def question_answer(input_document, history):
 
 
 
 
 
 
 
 
 
 
 
39
  context = input_document
 
40
  question = history[-1][0]
41
 
42
  texts = [context[k : k + 256] for k in range(0, len(context.split()), 256)]
@@ -45,7 +77,7 @@ def question_answer(input_document, history):
45
  model="multilingual-22-12", cohere_api_key=COHERE_API_KEY
46
  )
47
  context_index = Qdrant.from_texts(
48
- texts, embeddings, host=QDRANT_HOST, api_key=QDRANT_API_KEY
49
  )
50
 
51
  prompt_template = """Text: {context}
@@ -71,10 +103,36 @@ def question_answer(input_document, history):
71
  answer = answer.replace("\n", "").replace("Answer:", "")
72
  return answer
73
 
 
74
  def load_gpl_license():
75
- df = pd.read_csv("base/examples.csv")
76
- return df['doc'].iloc[0], df['question'].iloc[0]
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
  def load_pokemon_license():
79
- df = pd.read_csv("base/examples.csv")
80
- return df['doc'].iloc[1], df['question'].iloc[1]
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import pandas as pd
3
+ from typing import List
4
+
5
+ import cohere
6
  from langchain.embeddings.cohere import CohereEmbeddings
7
  from langchain.llms import Cohere
8
  from langchain.prompts import PromptTemplate
9
  from langchain.vectorstores import Qdrant
 
10
  from langchain.chains.question_answering import load_qa_chain
11
+
12
+ from .constants import SUMMARIZATION_MODEL, EXAMPLES_FILE_PATH
13
+
14
 
15
  # load environment variables
16
  QDRANT_HOST = os.environ.get("QDRANT_HOST")
17
  QDRANT_API_KEY = os.environ.get("QDRANT_API_KEY")
18
  COHERE_API_KEY = os.environ.get("COHERE_API_KEY")
19
 
 
 
 
20
 
21
  def summarize(
22
  document: str,
23
  summary_length: str,
24
  summary_format: str,
25
+ extractiveness: str = "high",
26
+ temperature: float = 0.6,
27
+ ) -> str:
28
+ """
29
+ Generates a summary for the input document using Cohere's summarize API.
30
+ Args:
31
+ document (`str`):
32
+ The document given by the user for which summary must be generated.
33
+ summary_length (`str`):
34
+ A value such as 'short', 'medium', 'long' indicating the length of the summary.
35
+ summary_format (`str`):
36
+ This indicates whether the generated summary should be in 'paragraph' format or 'bullets'.
37
+ extractiveness (`str`, *optional*, defaults to 'high'):
38
+ A value such as 'low', 'medium', 'high' indicating how close the generated summary should be in meaning to the original text.
39
+ temperature (`str`):
40
+ This controls the randomness of the output. Lower values tend to generate more “predictable” output, while higher values tend to generate more “creative” output.
41
+ Returns:
42
+ generated_summary (`str`):
43
+ The generated summary from the summarization model.
44
+ """
45
+
46
  summary_response = cohere.Client(COHERE_API_KEY).summarize(
47
  text=document,
48
  length=summary_length,
 
51
  extractiveness=extractiveness,
52
  temperature=temperature,
53
  )
54
+ generated_summary = summary_response.summary
55
+ return generated_summary
56
 
57
 
58
+ def question_answer(input_document: str, history: List) -> str:
59
+ """
60
+ Generates an appropriate answer for the question asked by the user based on the input document.
61
+ Args:
62
+ input_document (`str`):
63
+ The document given by the user for which summary must be generated.
64
+ history (`List[List[str,str]]`):
65
+ A list made up of pairs of input question asked by the user & corresponding generated answers. It is used to keep track of the history of the chat between the user and the model.
66
+ Returns:
67
+ answer (`str`):
68
+ The generated answer corresponding to the input question and document received from the user.
69
+ """
70
  context = input_document
71
+ # The last element of the `history` list contains the most recent question asked by the user whose answer needs to be generated.
72
  question = history[-1][0]
73
 
74
  texts = [context[k : k + 256] for k in range(0, len(context.split()), 256)]
 
77
  model="multilingual-22-12", cohere_api_key=COHERE_API_KEY
78
  )
79
  context_index = Qdrant.from_texts(
80
+ texts, embeddings, host=QDRANT_HOST, api_key=QDRANT_API_KEY, port=443,
81
  )
82
 
83
  prompt_template = """Text: {context}
 
103
  answer = answer.replace("\n", "").replace("Answer:", "")
104
  return answer
105
 
106
+
107
  def load_gpl_license():
108
+ """
109
+ Read GPL license document and sample question to be loaded as an example on the UI.
110
+
111
+ Returns:
112
+ gpl_doc (`str`):
113
+ GPL license document which will be loaded as an example on the UI.
114
+ sample_question (`str`):
115
+ A sample question related to GPL license document.
116
+
117
+ """
118
+ examples_df = pd.read_csv(EXAMPLES_FILE_PATH)
119
+ gpl_doc = examples_df["doc"].iloc[0]
120
+ sample_question = examples_df["question"].iloc[0]
121
+ return gpl_doc, sample_question
122
+
123
 
124
  def load_pokemon_license():
125
+ """
126
+ Read PokemonGo license document and sample question to be loaded as an example on the UI.
127
+
128
+ Returns:
129
+ pokemon_license (`str`):
130
+ PokemonGo license document which will be loaded as an example on the UI.
131
+ sample_question (`str`):
132
+ A sample question related to PokemonGo license document.
133
+
134
+ """
135
+ examples_df = pd.read_csv(EXAMPLES_FILE_PATH)
136
+ pokemon_license = examples_df["doc"].iloc[1]
137
+ sample_question = examples_df["question"].iloc[1]
138
+ return pokemon_license, sample_question
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
  cohere
2
- qdrant-client
3
  datasets
4
  langchain
5
  gradio
6
- black
 
1
  cohere
2
+ qdrant_client
3
  datasets
4
  langchain
5
  gradio
6
+ black
themes/theme_schema@0.0.1.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"theme": {"_font": [{"__gradio_font__": true, "name": "Montserrat", "class": "google"}, {"__gradio_font__": true, "name": "ui-sans-serif", "class": "font"}, {"__gradio_font__": true, "name": "system-ui", "class": "font"}, {"__gradio_font__": true, "name": "sans-serif", "class": "font"}], "_font_mono": [{"__gradio_font__": true, "name": "IBM Plex Mono", "class": "google"}, {"__gradio_font__": true, "name": "ui-monospace", "class": "font"}, {"__gradio_font__": true, "name": "Consolas", "class": "font"}, {"__gradio_font__": true, "name": "monospace", "class": "font"}], "_stylesheets": ["https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600&display=swap", "https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap"], "background_fill_primary": "*neutral_50", "background_fill_primary_dark": "*neutral_950", "background_fill_secondary": "*neutral_50", "background_fill_secondary_dark": "*neutral_900", "block_background_fill": "white", "block_background_fill_dark": "*neutral_800", "block_border_color": "*border_color_primary", "block_border_color_dark": "*border_color_primary", "block_border_width": "0px", "block_info_text_color": "*body_text_color_subdued", "block_info_text_color_dark": "*body_text_color_subdued", "block_info_text_size": "*text_sm", "block_info_text_weight": "400", "block_label_background_fill": "*primary_100", "block_label_background_fill_dark": "*primary_600", "block_label_border_color": "*border_color_primary", "block_label_border_color_dark": "*border_color_primary", "block_label_border_width": "1px", "block_label_margin": "*spacing_md", "block_label_padding": "*spacing_sm *spacing_md", "block_label_radius": "*radius_md", "block_label_right_radius": "0 calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px)", "block_label_text_color": "*primary_500", "block_label_text_color_dark": "*white", "block_label_text_size": "*text_md", "block_label_text_weight": "600", "block_padding": "*spacing_xl calc(*spacing_xl + 2px)", "block_radius": "*radius_lg", "block_shadow": "none", "block_title_background_fill": "*block_label_background_fill", "block_title_border_color": "none", "block_title_border_width": "0px", "block_title_padding": "*block_label_padding", "block_title_radius": "*block_label_radius", "block_title_text_color": "*primary_500", "block_title_text_color_dark": "*white", "block_title_text_size": "*text_md", "block_title_text_weight": "600", "body_background_fill": "*background_fill_primary", "body_background_fill_dark": "*background_fill_primary", "body_text_color": "*neutral_800", "body_text_color_dark": "*neutral_100", "body_text_color_subdued": "*neutral_400", "body_text_color_subdued_dark": "*neutral_400", "body_text_size": "*text_md", "body_text_weight": "400", "border_color_accent": "*primary_300", "border_color_accent_dark": "*neutral_600", "border_color_primary": "*neutral_200", "border_color_primary_dark": "*neutral_700", "button_border_width": "*input_border_width", "button_border_width_dark": "*input_border_width", "button_cancel_background_fill": "*button_secondary_background_fill", "button_cancel_background_fill_dark": "*button_secondary_background_fill", "button_cancel_background_fill_hover": "*button_secondary_background_fill_hover", "button_cancel_background_fill_hover_dark": "*button_secondary_background_fill_hover", "button_cancel_border_color": "*button_secondary_border_color", "button_cancel_border_color_dark": "*button_secondary_border_color", "button_cancel_border_color_hover": "*button_cancel_border_color", "button_cancel_border_color_hover_dark": "*button_cancel_border_color", "button_cancel_text_color": "*button_secondary_text_color", "button_cancel_text_color_dark": "*button_secondary_text_color", "button_cancel_text_color_hover": "*button_cancel_text_color", "button_cancel_text_color_hover_dark": "*button_cancel_text_color", "button_large_padding": "*spacing_lg calc(2 * *spacing_lg)", "button_large_radius": "*radius_lg", "button_large_text_size": "*text_lg", "button_large_text_weight": "600", "button_primary_background_fill": "linear-gradient(90deg, *primary_300, *secondary_400)", "button_primary_background_fill_dark": "linear-gradient(90deg, *primary_600, *secondary_800)", "button_primary_background_fill_hover": "linear-gradient(90deg, *primary_200, *secondary_300)", "button_primary_background_fill_hover_dark": "*primary_500", "button_primary_border_color_hover": "*button_primary_border_color", "button_primary_border_color_hover_dark": "*button_primary_border_color", "button_primary_text_color": "white", "button_primary_text_color_dark": "white", "button_primary_text_color_hover": "*button_primary_text_color", "button_primary_text_color_hover_dark": "*button_primary_text_color", "button_secondary_background_fill": "white", "button_secondary_background_fill_dark": "*neutral_600", "button_secondary_background_fill_hover": "*neutral_100", "button_secondary_background_fill_hover_dark": "*primary_500", "button_secondary_border_color": "*neutral_200", "button_secondary_border_color_dark": "*neutral_600", "button_secondary_border_color_hover": "*button_secondary_border_color", "button_secondary_border_color_hover_dark": "*button_secondary_border_color", "button_secondary_text_color": "*neutral_800", "button_secondary_text_color_dark": "white", "button_secondary_text_color_hover": "*button_secondary_text_color", "button_secondary_text_color_hover_dark": "*button_secondary_text_color", "button_shadow": "*shadow_drop_lg", "button_shadow_active": "*shadow_inset", "button_shadow_hover": "*shadow_drop_lg", "button_small_padding": "*spacing_sm calc(2 * *spacing_sm)", "button_small_radius": "*radius_lg", "button_small_text_size": "*text_md", "button_small_text_weight": "400", "button_transition": "background-color 0.2s ease", "checkbox_background_color": "*background_fill_primary", "checkbox_background_color_dark": "*neutral_800", "checkbox_background_color_focus": "*checkbox_background_color", "checkbox_background_color_focus_dark": "*checkbox_background_color", "checkbox_background_color_hover": "*checkbox_background_color", "checkbox_background_color_hover_dark": "*checkbox_background_color", "checkbox_background_color_selected": "*primary_600", "checkbox_background_color_selected_dark": "*primary_700", "checkbox_border_color": "*neutral_100", "checkbox_border_color_dark": "*neutral_600", "checkbox_border_color_focus": "*primary_500", "checkbox_border_color_focus_dark": "*primary_600", "checkbox_border_color_hover": "*neutral_300", "checkbox_border_color_hover_dark": "*neutral_600", "checkbox_border_color_selected": "*primary_600", "checkbox_border_color_selected_dark": "*primary_700", "checkbox_border_radius": "*radius_sm", "checkbox_border_width": "1px", "checkbox_border_width_dark": "*input_border_width", "checkbox_check": "url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e\")", "checkbox_label_background_fill": "*button_secondary_background_fill", "checkbox_label_background_fill_dark": "*button_secondary_background_fill", "checkbox_label_background_fill_hover": "*button_secondary_background_fill_hover", "checkbox_label_background_fill_hover_dark": "*button_secondary_background_fill_hover", "checkbox_label_background_fill_selected": "*primary_500", "checkbox_label_background_fill_selected_dark": "*primary_600", "checkbox_label_border_color": "*border_color_primary", "checkbox_label_border_color_dark": "*border_color_primary", "checkbox_label_border_color_hover": "*checkbox_label_border_color", "checkbox_label_border_color_hover_dark": "*checkbox_label_border_color", "checkbox_label_border_width": "*input_border_width", "checkbox_label_border_width_dark": "*input_border_width", "checkbox_label_gap": "*spacing_lg", "checkbox_label_padding": "*spacing_md calc(2 * *spacing_md)", "checkbox_label_shadow": "*shadow_drop_lg", "checkbox_label_text_color": "*body_text_color", "checkbox_label_text_color_dark": "*body_text_color", "checkbox_label_text_color_selected": "white", "checkbox_label_text_color_selected_dark": "*checkbox_label_text_color", "checkbox_label_text_size": "*text_md", "checkbox_label_text_weight": "400", "checkbox_shadow": "none", "color_accent": "*primary_500", "color_accent_soft": "*primary_50", "color_accent_soft_dark": "*neutral_700", "container_radius": "*radius_lg", "embed_radius": "*radius_lg", "error_background_fill": "#fee2e2", "error_background_fill_dark": "*background_fill_primary", "error_border_color": "#fecaca", "error_border_color_dark": "*border_color_primary", "error_border_width": "1px", "error_text_color": "#ef4444", "error_text_color_dark": "#ef4444", "font": "'Montserrat', 'ui-sans-serif', 'system-ui', sans-serif", "font_mono": "'IBM Plex Mono', 'ui-monospace', 'Consolas', monospace", "form_gap_width": "0px", "input_background_fill": "white", "input_background_fill_dark": "*neutral_700", "input_background_fill_focus": "*secondary_500", "input_background_fill_focus_dark": "*secondary_600", "input_background_fill_hover": "*input_background_fill", "input_background_fill_hover_dark": "*input_background_fill", "input_border_color": "*neutral_50", "input_border_color_dark": "*border_color_primary", "input_border_color_focus": "*secondary_300", "input_border_color_focus_dark": "*neutral_700", "input_border_color_hover": "*input_border_color", "input_border_color_hover_dark": "*input_border_color", "input_border_width": "0px", "input_padding": "*spacing_xl", "input_placeholder_color": "*neutral_400", "input_placeholder_color_dark": "*neutral_500", "input_radius": "*radius_lg", "input_shadow": "*shadow_drop", "input_shadow_focus": "*shadow_drop_lg", "input_text_size": "*text_md", "input_text_weight": "400", "layout_gap": "*spacing_xxl", "link_text_color": "*secondary_600", "link_text_color_active": "*secondary_600", "link_text_color_active_dark": "*secondary_500", "link_text_color_dark": "*secondary_500", "link_text_color_hover": "*secondary_700", "link_text_color_hover_dark": "*secondary_400", "link_text_color_visited": "*secondary_500", "link_text_color_visited_dark": "*secondary_600", "loader_color": "*color_accent", "neutral_100": "#f3f4f6", "neutral_200": "#e5e7eb", "neutral_300": "#d1d5db", "neutral_400": "#9ca3af", "neutral_50": "#f9fafb", "neutral_500": "#6b7280", "neutral_600": "#4b5563", "neutral_700": "#374151", "neutral_800": "#1f2937", "neutral_900": "#111827", "neutral_950": "#0b0f19", "panel_background_fill": "*background_fill_secondary", "panel_background_fill_dark": "*background_fill_secondary", "panel_border_color": "*border_color_primary", "panel_border_color_dark": "*border_color_primary", "panel_border_width": "1px", "primary_100": "#e0e7ff", "primary_200": "#c7d2fe", "primary_300": "#a5b4fc", "primary_400": "#818cf8", "primary_50": "#eef2ff", "primary_500": "#6366f1", "primary_600": "#4f46e5", "primary_700": "#4338ca", "primary_800": "#3730a3", "primary_900": "#312e81", "primary_950": "#2b2c5e", "prose_header_text_weight": "600", "prose_text_size": "*text_md", "prose_text_weight": "400", "radio_circle": "url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e\")", "radius_lg": "8px", "radius_md": "6px", "radius_sm": "4px", "radius_xl": "12px", "radius_xs": "2px", "radius_xxl": "22px", "radius_xxs": "1px", "secondary_100": "#e0e7ff", "secondary_200": "#c7d2fe", "secondary_300": "#a5b4fc", "secondary_400": "#818cf8", "secondary_50": "#eef2ff", "secondary_500": "#6366f1", "secondary_600": "#4f46e5", "secondary_700": "#4338ca", "secondary_800": "#3730a3", "secondary_900": "#312e81", "secondary_950": "#2b2c5e", "section_header_text_size": "*text_md", "section_header_text_weight": "400", "shadow_drop": "0 1px 4px 0 rgb(0 0 0 / 0.1)", "shadow_drop_lg": "0 2px 5px 0 rgb(0 0 0 / 0.1)", "shadow_inset": "rgba(0,0,0,0.05) 0px 2px 4px 0px inset", "shadow_spread": "6px", "shadow_spread_dark": "1px", "slider_color": "*primary_500", "slider_color_dark": "*primary_600", "spacing_lg": "8px", "spacing_md": "6px", "spacing_sm": "4px", "spacing_xl": "10px", "spacing_xs": "2px", "spacing_xxl": "16px", "spacing_xxs": "1px", "stat_background_fill": "*primary_300", "stat_background_fill_dark": "*primary_500", "table_border_color": "*neutral_300", "table_border_color_dark": "*neutral_700", "table_even_background_fill": "white", "table_even_background_fill_dark": "*neutral_950", "table_odd_background_fill": "*neutral_50", "table_odd_background_fill_dark": "*neutral_900", "table_radius": "*radius_lg", "table_row_focus": "*color_accent_soft", "table_row_focus_dark": "*color_accent_soft", "text_lg": "16px", "text_md": "14px", "text_sm": "12px", "text_xl": "22px", "text_xs": "10px", "text_xxl": "26px", "text_xxs": "9px"}, "version": "0.0.1"}