Spaces:
Sleeping
Sleeping
sunnychenxiwang
commited on
Commit
•
55d9644
1
Parent(s):
bd1679c
all
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- app.py +14 -43
- models/dbnetpp.pth +3 -0
- models/groundingdino_swint_ogc.pth +3 -0
- models/maerec_b.pth +3 -0
- pipeline/__pycache__/judge.cpython-39.pyc +0 -0
- pipeline/__pycache__/query_generate.cpython-39.pyc +0 -0
- pipeline/__pycache__/run_pipeline.cpython-39.pyc +0 -0
- pipeline/__pycache__/tool_execute.cpython-39.pyc +0 -0
- pipeline/cache_files/COCO_val2014_000000297425.jpg +0 -0
- pipeline/cache_files/COCO_val2014_000000297425/2Axrpnw7ricrqoNoRqLPPm.jpg +0 -0
- pipeline/cache_files/COCO_val2014_000000297425/N7r9ReNBe73cY2VL7gW9Az.jpg +0 -0
- pipeline/cache_files/COCO_val2014_000000297425/Wr7HRVVj6HtMGbsDbaXdU3.jpg +0 -0
- pipeline/cache_files/COCO_val2014_000000297425/max6iKdGyovWLMJzKQ4RHr.jpg +0 -0
- pipeline/judge.py +15 -11
- pipeline/nltk/VERSION +0 -1
- pipeline/nltk/__init__.py +0 -209
- pipeline/nltk/__pycache__/__init__.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/book.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/cli.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/collections.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/collocations.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/compat.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/data.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/decorators.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/downloader.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/featstruct.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/grammar.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/help.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/internals.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/jsontags.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/langnames.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/lazyimport.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/probability.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/text.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/tgrep.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/toolbox.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/treeprettyprinter.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/treetransforms.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/util.cpython-39.pyc +0 -0
- pipeline/nltk/__pycache__/wsd.cpython-39.pyc +0 -0
- pipeline/nltk/app/__init__.py +0 -47
- pipeline/nltk/app/__pycache__/__init__.cpython-39.pyc +0 -0
- pipeline/nltk/app/__pycache__/chartparser_app.cpython-39.pyc +0 -0
- pipeline/nltk/app/__pycache__/chunkparser_app.cpython-39.pyc +0 -0
- pipeline/nltk/app/__pycache__/collocations_app.cpython-39.pyc +0 -0
- pipeline/nltk/app/__pycache__/concordance_app.cpython-39.pyc +0 -0
- pipeline/nltk/app/__pycache__/nemo_app.cpython-39.pyc +0 -0
- pipeline/nltk/app/__pycache__/rdparser_app.cpython-39.pyc +0 -0
- pipeline/nltk/app/__pycache__/srparser_app.cpython-39.pyc +0 -0
- pipeline/nltk/app/__pycache__/wordfreq_app.cpython-39.pyc +0 -0
app.py
CHANGED
@@ -1,58 +1,29 @@
|
|
1 |
|
2 |
import gradio as gr
|
3 |
from pipeline.run_pipeline import *
|
|
|
|
|
|
|
|
|
|
|
4 |
# from run import *
|
5 |
# '''
|
6 |
# 把一些文件移动到此文件路径下
|
7 |
# '''
|
8 |
# text = "A person is cutting a birthday cake with two red candles that spell out \"21\". The surface of the cake is round, and there is a balloon in the room. The person is using a silver knife to cut the cake."
|
9 |
# image_path = "/newdisk3/wcx/val2014/COCO_val2014_000000297425.jpg"
|
|
|
|
|
|
|
10 |
|
11 |
-
def get_response(text, filepath):
|
12 |
-
pipeline =
|
13 |
-
|
14 |
-
return res
|
15 |
|
16 |
demo = gr.Interface(
|
17 |
fn=get_response,
|
18 |
-
inputs=["text", gr.Image(type="filepath")],
|
19 |
-
outputs=["
|
20 |
)
|
21 |
|
22 |
-
demo.launch()
|
23 |
-
|
24 |
-
# def generate_mutimodal(title, context, img):
|
25 |
-
# return f"Title:{title}\nContext:{context}\n...{img}"
|
26 |
-
|
27 |
-
# server = gr.Interface(
|
28 |
-
# fn=generate_mutimodal,
|
29 |
-
# inputs=[
|
30 |
-
# gr.Textbox(lines=1, placeholder="请输入标题"),
|
31 |
-
# gr.Textbox(lines=2, placeholder="请输入正文"),
|
32 |
-
# gr.Image(shape=(200, 200), label="请上传图片(可选)")
|
33 |
-
# ],
|
34 |
-
# outputs="text"
|
35 |
-
# )
|
36 |
-
|
37 |
-
# server.launch()
|
38 |
-
|
39 |
-
# import numpy as np
|
40 |
-
# import gradio as gr
|
41 |
-
# def sepia(input_img):
|
42 |
-
# #处理图像
|
43 |
-
# sepia_filter = np.array([
|
44 |
-
# [0.393, 0.769, 0.189],
|
45 |
-
# [0.349, 0.686, 0.168],
|
46 |
-
# [0.272, 0.534, 0.131]
|
47 |
-
# ])
|
48 |
-
# sepia_img = input_img.dot(sepia_filter.T)
|
49 |
-
# sepia_img /= sepia_img.max()
|
50 |
-
# return sepia_img
|
51 |
-
# #shape设置输入图像大小
|
52 |
-
# demo = gr.Interface(sepia, gr.Image(), "image")
|
53 |
-
# demo.launch()
|
54 |
-
|
55 |
-
# Download human-readable labels for ImageNet.
|
56 |
-
|
57 |
-
# gr.Interface(fn=sepia,inputs=gr.Image(type="pil"),outputs="image").launch()
|
58 |
-
|
|
|
1 |
|
2 |
import gradio as gr
|
3 |
from pipeline.run_pipeline import *
|
4 |
+
'''
|
5 |
+
时间优化
|
6 |
+
并发优化
|
7 |
+
'''
|
8 |
+
|
9 |
# from run import *
|
10 |
# '''
|
11 |
# 把一些文件移动到此文件路径下
|
12 |
# '''
|
13 |
# text = "A person is cutting a birthday cake with two red candles that spell out \"21\". The surface of the cake is round, and there is a balloon in the room. The person is using a silver knife to cut the cake."
|
14 |
# image_path = "/newdisk3/wcx/val2014/COCO_val2014_000000297425.jpg"
|
15 |
+
pipeline = Pipeline(type="image-to-text", api_key="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")
|
16 |
+
# res,claim_list = pipeline.run(text=text, image_path=image_path,type="image-to-text")
|
17 |
+
# print(res)
|
18 |
|
19 |
+
def get_response(text, filepath, type):
|
20 |
+
res, claim_list = pipeline.run(text=text, image_path=filepath, type=type)
|
21 |
+
return claim_list, res
|
|
|
22 |
|
23 |
demo = gr.Interface(
|
24 |
fn=get_response,
|
25 |
+
inputs=[gr.Textbox(placeholder="Input I2T model's response or T2I model's prompt", label="text input"), gr.Image(type="filepath", label="image input"), gr.Radio(['image-to-text','text-to-image'], label='task type', value='image-to-text')],
|
26 |
+
outputs=[gr.Textbox(label="claim list"), gr.Textbox(label="detect results")],
|
27 |
)
|
28 |
|
29 |
+
demo.queue().launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
models/dbnetpp.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4ecb39ac54bd954fa44fd25b419b7a51539ded0f79408eb2419ca78f9f0299c6
|
3 |
+
size 113299489
|
models/groundingdino_swint_ogc.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3b3ca2563c77c69f651d7bd133e97139c186df06231157a64c507099c52bc799
|
3 |
+
size 693997677
|
models/maerec_b.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:69a98230f5421517bce9fdc197261ec6845e353ceb7fa970194c04403e0ba89b
|
3 |
+
size 1764777173
|
pipeline/__pycache__/judge.cpython-39.pyc
CHANGED
Binary files a/pipeline/__pycache__/judge.cpython-39.pyc and b/pipeline/__pycache__/judge.cpython-39.pyc differ
|
|
pipeline/__pycache__/query_generate.cpython-39.pyc
CHANGED
Binary files a/pipeline/__pycache__/query_generate.cpython-39.pyc and b/pipeline/__pycache__/query_generate.cpython-39.pyc differ
|
|
pipeline/__pycache__/run_pipeline.cpython-39.pyc
CHANGED
Binary files a/pipeline/__pycache__/run_pipeline.cpython-39.pyc and b/pipeline/__pycache__/run_pipeline.cpython-39.pyc differ
|
|
pipeline/__pycache__/tool_execute.cpython-39.pyc
CHANGED
Binary files a/pipeline/__pycache__/tool_execute.cpython-39.pyc and b/pipeline/__pycache__/tool_execute.cpython-39.pyc differ
|
|
pipeline/cache_files/COCO_val2014_000000297425.jpg
ADDED
pipeline/cache_files/COCO_val2014_000000297425/2Axrpnw7ricrqoNoRqLPPm.jpg
ADDED
pipeline/cache_files/COCO_val2014_000000297425/N7r9ReNBe73cY2VL7gW9Az.jpg
ADDED
pipeline/cache_files/COCO_val2014_000000297425/Wr7HRVVj6HtMGbsDbaXdU3.jpg
ADDED
pipeline/cache_files/COCO_val2014_000000297425/max6iKdGyovWLMJzKQ4RHr.jpg
ADDED
pipeline/judge.py
CHANGED
@@ -2,9 +2,9 @@ import json
|
|
2 |
import yaml
|
3 |
import base64
|
4 |
class Judger:
|
5 |
-
def __init__(self, prompt_path, chat
|
6 |
with open(prompt_path,"r",encoding='utf-8') as file:
|
7 |
-
self.prompt = yaml.load(file, yaml.FullLoader)
|
8 |
self.chat = chat
|
9 |
|
10 |
|
@@ -12,7 +12,7 @@ class Judger:
|
|
12 |
with open(image_path, "rb") as image_file:
|
13 |
return base64.b64encode(image_file.read()).decode('utf-8')
|
14 |
|
15 |
-
def get_response(self, object_res, attribue_res, text_res, fact_res, claim_list, image_path):
|
16 |
input = '''
|
17 |
Here is the object detection expert model's result:
|
18 |
{object}
|
@@ -40,24 +40,28 @@ class Judger:
|
|
40 |
else:
|
41 |
text_det = "none information"
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
46 |
base64_source_image = self.encode_image(image_path)
|
47 |
content = [
|
48 |
-
{"type": "text", "text": self.prompt["user"]},
|
49 |
{"type": "image_url","image_url": f"data:image/jpeg;base64,{img1}"},
|
50 |
-
{"type": "text", "text": self.prompt["example1"]},
|
51 |
{"type": "image_url","image_url": f"data:image/jpeg;base64,{img2}"},
|
52 |
-
{"type": "text", "text": self.prompt["example2"]},
|
53 |
{"type": "image_url","image_url": f"data:image/jpeg;base64,{base64_source_image}"},
|
54 |
{"type": "text", "text": input.format(object=object_det,text=text_det,fact=fact_res,claims=claim_list)}
|
55 |
]
|
56 |
-
|
|
|
57 |
message = [
|
58 |
{
|
59 |
'role': 'system',
|
60 |
-
'content': self.prompt["system"]
|
61 |
},
|
62 |
{
|
63 |
"role": "user",
|
|
|
2 |
import yaml
|
3 |
import base64
|
4 |
class Judger:
|
5 |
+
def __init__(self, prompt_path, chat):
|
6 |
with open(prompt_path,"r",encoding='utf-8') as file:
|
7 |
+
self.prompt = yaml.load(file, yaml.FullLoader)
|
8 |
self.chat = chat
|
9 |
|
10 |
|
|
|
12 |
with open(image_path, "rb") as image_file:
|
13 |
return base64.b64encode(image_file.read()).decode('utf-8')
|
14 |
|
15 |
+
def get_response(self, type, object_res, attribue_res, text_res, fact_res, claim_list, image_path):
|
16 |
input = '''
|
17 |
Here is the object detection expert model's result:
|
18 |
{object}
|
|
|
40 |
else:
|
41 |
text_det = "none information"
|
42 |
|
43 |
+
if type == "image-to-text":
|
44 |
+
img1 = self.encode_image("/home/wcx/wcx/GroundingDINO/LVLM/cot/img_examples/sandbeach.jpg")
|
45 |
+
img2 = self.encode_image("/home/wcx/wcx/GroundingDINO/LVLM/cot/img_examples/football.jpg")
|
46 |
+
else:
|
47 |
+
img1 = self.encode_image("/home/wcx/wcx/GroundingDINO/LVLM/cot/img_examples/animal.jpg")
|
48 |
+
img2 = self.encode_image("/home/wcx/wcx/GroundingDINO/LVLM/cot/img_examples/ball.jpg")
|
49 |
base64_source_image = self.encode_image(image_path)
|
50 |
content = [
|
51 |
+
{"type": "text", "text": self.prompt[type]["user"]},
|
52 |
{"type": "image_url","image_url": f"data:image/jpeg;base64,{img1}"},
|
53 |
+
{"type": "text", "text": self.prompt[type]["example1"]},
|
54 |
{"type": "image_url","image_url": f"data:image/jpeg;base64,{img2}"},
|
55 |
+
{"type": "text", "text": self.prompt[type]["example2"]},
|
56 |
{"type": "image_url","image_url": f"data:image/jpeg;base64,{base64_source_image}"},
|
57 |
{"type": "text", "text": input.format(object=object_det,text=text_det,fact=fact_res,claims=claim_list)}
|
58 |
]
|
59 |
+
|
60 |
+
|
61 |
message = [
|
62 |
{
|
63 |
'role': 'system',
|
64 |
+
'content': self.prompt[type]["system"]
|
65 |
},
|
66 |
{
|
67 |
"role": "user",
|
pipeline/nltk/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
3.8.1
|
|
|
|
pipeline/nltk/__init__.py
DELETED
@@ -1,209 +0,0 @@
|
|
1 |
-
# Natural Language Toolkit (NLTK)
|
2 |
-
#
|
3 |
-
# Copyright (C) 2001-2023 NLTK Project
|
4 |
-
# Authors: Steven Bird <stevenbird1@gmail.com>
|
5 |
-
# Edward Loper <edloper@gmail.com>
|
6 |
-
# URL: <https://www.nltk.org/>
|
7 |
-
# For license information, see LICENSE.TXT
|
8 |
-
|
9 |
-
"""
|
10 |
-
The Natural Language Toolkit (NLTK) is an open source Python library
|
11 |
-
for Natural Language Processing. A free online book is available.
|
12 |
-
(If you use the library for academic research, please cite the book.)
|
13 |
-
|
14 |
-
Steven Bird, Ewan Klein, and Edward Loper (2009).
|
15 |
-
Natural Language Processing with Python. O'Reilly Media Inc.
|
16 |
-
https://www.nltk.org/book/
|
17 |
-
|
18 |
-
isort:skip_file
|
19 |
-
"""
|
20 |
-
|
21 |
-
import os
|
22 |
-
|
23 |
-
# //////////////////////////////////////////////////////
|
24 |
-
# Metadata
|
25 |
-
# //////////////////////////////////////////////////////
|
26 |
-
|
27 |
-
# Version. For each new release, the version number should be updated
|
28 |
-
# in the file VERSION.
|
29 |
-
try:
|
30 |
-
# If a VERSION file exists, use it!
|
31 |
-
version_file = os.path.join(os.path.dirname(__file__), "VERSION")
|
32 |
-
with open(version_file) as infile:
|
33 |
-
__version__ = infile.read().strip()
|
34 |
-
except NameError:
|
35 |
-
__version__ = "unknown (running code interactively?)"
|
36 |
-
except OSError as ex:
|
37 |
-
__version__ = "unknown (%s)" % ex
|
38 |
-
|
39 |
-
if __doc__ is not None: # fix for the ``python -OO``
|
40 |
-
__doc__ += "\n@version: " + __version__
|
41 |
-
|
42 |
-
|
43 |
-
# Copyright notice
|
44 |
-
__copyright__ = """\
|
45 |
-
Copyright (C) 2001-2023 NLTK Project.
|
46 |
-
|
47 |
-
Distributed and Licensed under the Apache License, Version 2.0,
|
48 |
-
which is included by reference.
|
49 |
-
"""
|
50 |
-
|
51 |
-
__license__ = "Apache License, Version 2.0"
|
52 |
-
# Description of the toolkit, keywords, and the project's primary URL.
|
53 |
-
__longdescr__ = """\
|
54 |
-
The Natural Language Toolkit (NLTK) is a Python package for
|
55 |
-
natural language processing. NLTK requires Python 3.7, 3.8, 3.9, 3.10 or 3.11."""
|
56 |
-
__keywords__ = [
|
57 |
-
"NLP",
|
58 |
-
"CL",
|
59 |
-
"natural language processing",
|
60 |
-
"computational linguistics",
|
61 |
-
"parsing",
|
62 |
-
"tagging",
|
63 |
-
"tokenizing",
|
64 |
-
"syntax",
|
65 |
-
"linguistics",
|
66 |
-
"language",
|
67 |
-
"natural language",
|
68 |
-
"text analytics",
|
69 |
-
]
|
70 |
-
__url__ = "https://www.nltk.org/"
|
71 |
-
|
72 |
-
# Maintainer, contributors, etc.
|
73 |
-
__maintainer__ = "NLTK Team"
|
74 |
-
__maintainer_email__ = "nltk.team@gmail.com"
|
75 |
-
__author__ = __maintainer__
|
76 |
-
__author_email__ = __maintainer_email__
|
77 |
-
|
78 |
-
# "Trove" classifiers for Python Package Index.
|
79 |
-
__classifiers__ = [
|
80 |
-
"Development Status :: 5 - Production/Stable",
|
81 |
-
"Intended Audience :: Developers",
|
82 |
-
"Intended Audience :: Education",
|
83 |
-
"Intended Audience :: Information Technology",
|
84 |
-
"Intended Audience :: Science/Research",
|
85 |
-
"License :: OSI Approved :: Apache Software License",
|
86 |
-
"Operating System :: OS Independent",
|
87 |
-
"Programming Language :: Python :: 3.7",
|
88 |
-
"Programming Language :: Python :: 3.8",
|
89 |
-
"Programming Language :: Python :: 3.9",
|
90 |
-
"Programming Language :: Python :: 3.10",
|
91 |
-
"Programming Language :: Python :: 3.11",
|
92 |
-
"Topic :: Scientific/Engineering",
|
93 |
-
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
94 |
-
"Topic :: Scientific/Engineering :: Human Machine Interfaces",
|
95 |
-
"Topic :: Scientific/Engineering :: Information Analysis",
|
96 |
-
"Topic :: Text Processing",
|
97 |
-
"Topic :: Text Processing :: Filters",
|
98 |
-
"Topic :: Text Processing :: General",
|
99 |
-
"Topic :: Text Processing :: Indexing",
|
100 |
-
"Topic :: Text Processing :: Linguistic",
|
101 |
-
]
|
102 |
-
|
103 |
-
from nltk.internals import config_java
|
104 |
-
|
105 |
-
# support numpy from pypy
|
106 |
-
try:
|
107 |
-
import numpypy
|
108 |
-
except ImportError:
|
109 |
-
pass
|
110 |
-
|
111 |
-
# Override missing methods on environments where it cannot be used like GAE.
|
112 |
-
import subprocess
|
113 |
-
|
114 |
-
if not hasattr(subprocess, "PIPE"):
|
115 |
-
|
116 |
-
def _fake_PIPE(*args, **kwargs):
|
117 |
-
raise NotImplementedError("subprocess.PIPE is not supported.")
|
118 |
-
|
119 |
-
subprocess.PIPE = _fake_PIPE
|
120 |
-
if not hasattr(subprocess, "Popen"):
|
121 |
-
|
122 |
-
def _fake_Popen(*args, **kwargs):
|
123 |
-
raise NotImplementedError("subprocess.Popen is not supported.")
|
124 |
-
|
125 |
-
subprocess.Popen = _fake_Popen
|
126 |
-
|
127 |
-
###########################################################
|
128 |
-
# TOP-LEVEL MODULES
|
129 |
-
###########################################################
|
130 |
-
|
131 |
-
# Import top-level functionality into top-level namespace
|
132 |
-
|
133 |
-
from nltk.collocations import *
|
134 |
-
from nltk.decorators import decorator, memoize
|
135 |
-
from nltk.featstruct import *
|
136 |
-
from nltk.grammar import *
|
137 |
-
from nltk.probability import *
|
138 |
-
from nltk.text import *
|
139 |
-
from nltk.util import *
|
140 |
-
from nltk.jsontags import *
|
141 |
-
|
142 |
-
###########################################################
|
143 |
-
# PACKAGES
|
144 |
-
###########################################################
|
145 |
-
|
146 |
-
from nltk.chunk import *
|
147 |
-
from nltk.classify import *
|
148 |
-
from nltk.inference import *
|
149 |
-
from nltk.metrics import *
|
150 |
-
from nltk.parse import *
|
151 |
-
from nltk.tag import *
|
152 |
-
from nltk.tokenize import *
|
153 |
-
from nltk.translate import *
|
154 |
-
from nltk.tree import *
|
155 |
-
from nltk.sem import *
|
156 |
-
from nltk.stem import *
|
157 |
-
|
158 |
-
# Packages which can be lazily imported
|
159 |
-
# (a) we don't import *
|
160 |
-
# (b) they're slow to import or have run-time dependencies
|
161 |
-
# that can safely fail at run time
|
162 |
-
|
163 |
-
from nltk import lazyimport
|
164 |
-
|
165 |
-
app = lazyimport.LazyModule("app", locals(), globals())
|
166 |
-
chat = lazyimport.LazyModule("chat", locals(), globals())
|
167 |
-
corpus = lazyimport.LazyModule("corpus", locals(), globals())
|
168 |
-
draw = lazyimport.LazyModule("draw", locals(), globals())
|
169 |
-
toolbox = lazyimport.LazyModule("toolbox", locals(), globals())
|
170 |
-
|
171 |
-
# Optional loading
|
172 |
-
|
173 |
-
try:
|
174 |
-
import numpy
|
175 |
-
except ImportError:
|
176 |
-
pass
|
177 |
-
else:
|
178 |
-
from nltk import cluster
|
179 |
-
|
180 |
-
from nltk.downloader import download, download_shell
|
181 |
-
|
182 |
-
try:
|
183 |
-
import tkinter
|
184 |
-
except ImportError:
|
185 |
-
pass
|
186 |
-
else:
|
187 |
-
try:
|
188 |
-
from nltk.downloader import download_gui
|
189 |
-
except RuntimeError as e:
|
190 |
-
import warnings
|
191 |
-
|
192 |
-
warnings.warn(
|
193 |
-
"Corpus downloader GUI not loaded "
|
194 |
-
"(RuntimeError during import: %s)" % str(e)
|
195 |
-
)
|
196 |
-
|
197 |
-
# explicitly import all top-level modules (ensuring
|
198 |
-
# they override the same names inadvertently imported
|
199 |
-
# from a subpackage)
|
200 |
-
|
201 |
-
from nltk import ccg, chunk, classify, collocations
|
202 |
-
from nltk import data, featstruct, grammar, help, inference, metrics
|
203 |
-
from nltk import misc, parse, probability, sem, stem, wsd
|
204 |
-
from nltk import tag, tbl, text, tokenize, translate, tree, util
|
205 |
-
|
206 |
-
|
207 |
-
# FIXME: override any accidentally imported demo, see https://github.com/nltk/nltk/issues/2116
|
208 |
-
def demo():
|
209 |
-
print("To run the demo code for a module, type nltk.module.demo()")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pipeline/nltk/__pycache__/__init__.cpython-39.pyc
DELETED
Binary file (4.84 kB)
|
|
pipeline/nltk/__pycache__/book.cpython-39.pyc
DELETED
Binary file (2.99 kB)
|
|
pipeline/nltk/__pycache__/cli.cpython-39.pyc
DELETED
Binary file (1.63 kB)
|
|
pipeline/nltk/__pycache__/collections.cpython-39.pyc
DELETED
Binary file (23.4 kB)
|
|
pipeline/nltk/__pycache__/collocations.cpython-39.pyc
DELETED
Binary file (14.9 kB)
|
|
pipeline/nltk/__pycache__/compat.cpython-39.pyc
DELETED
Binary file (1.13 kB)
|
|
pipeline/nltk/__pycache__/data.cpython-39.pyc
DELETED
Binary file (38.6 kB)
|
|
pipeline/nltk/__pycache__/decorators.cpython-39.pyc
DELETED
Binary file (6.43 kB)
|
|
pipeline/nltk/__pycache__/downloader.cpython-39.pyc
DELETED
Binary file (61.9 kB)
|
|
pipeline/nltk/__pycache__/featstruct.cpython-39.pyc
DELETED
Binary file (74.1 kB)
|
|
pipeline/nltk/__pycache__/grammar.cpython-39.pyc
DELETED
Binary file (53.7 kB)
|
|
pipeline/nltk/__pycache__/help.cpython-39.pyc
DELETED
Binary file (1.63 kB)
|
|
pipeline/nltk/__pycache__/internals.cpython-39.pyc
DELETED
Binary file (29 kB)
|
|
pipeline/nltk/__pycache__/jsontags.cpython-39.pyc
DELETED
Binary file (2.31 kB)
|
|
pipeline/nltk/__pycache__/langnames.cpython-39.pyc
DELETED
Binary file (15.3 kB)
|
|
pipeline/nltk/__pycache__/lazyimport.cpython-39.pyc
DELETED
Binary file (3.73 kB)
|
|
pipeline/nltk/__pycache__/probability.cpython-39.pyc
DELETED
Binary file (87.2 kB)
|
|
pipeline/nltk/__pycache__/text.cpython-39.pyc
DELETED
Binary file (28.4 kB)
|
|
pipeline/nltk/__pycache__/tgrep.cpython-39.pyc
DELETED
Binary file (35.3 kB)
|
|
pipeline/nltk/__pycache__/toolbox.cpython-39.pyc
DELETED
Binary file (15.8 kB)
|
|
pipeline/nltk/__pycache__/treeprettyprinter.cpython-39.pyc
DELETED
Binary file (952 Bytes)
|
|
pipeline/nltk/__pycache__/treetransforms.cpython-39.pyc
DELETED
Binary file (4.99 kB)
|
|
pipeline/nltk/__pycache__/util.cpython-39.pyc
DELETED
Binary file (32.5 kB)
|
|
pipeline/nltk/__pycache__/wsd.cpython-39.pyc
DELETED
Binary file (1.82 kB)
|
|
pipeline/nltk/app/__init__.py
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
# Natural Language Toolkit: Applications package
|
2 |
-
#
|
3 |
-
# Copyright (C) 2001-2023 NLTK Project
|
4 |
-
# Author: Edward Loper <edloper@gmail.com>
|
5 |
-
# Steven Bird <stevenbird1@gmail.com>
|
6 |
-
# URL: <https://www.nltk.org/>
|
7 |
-
# For license information, see LICENSE.TXT
|
8 |
-
|
9 |
-
"""
|
10 |
-
Interactive NLTK Applications:
|
11 |
-
|
12 |
-
chartparser: Chart Parser
|
13 |
-
chunkparser: Regular-Expression Chunk Parser
|
14 |
-
collocations: Find collocations in text
|
15 |
-
concordance: Part-of-speech concordancer
|
16 |
-
nemo: Finding (and Replacing) Nemo regular expression tool
|
17 |
-
rdparser: Recursive Descent Parser
|
18 |
-
srparser: Shift-Reduce Parser
|
19 |
-
wordnet: WordNet Browser
|
20 |
-
"""
|
21 |
-
|
22 |
-
|
23 |
-
# Import Tkinter-based modules if Tkinter is installed
|
24 |
-
try:
|
25 |
-
import tkinter
|
26 |
-
except ImportError:
|
27 |
-
import warnings
|
28 |
-
|
29 |
-
warnings.warn("nltk.app package not loaded (please install Tkinter library).")
|
30 |
-
else:
|
31 |
-
from nltk.app.chartparser_app import app as chartparser
|
32 |
-
from nltk.app.chunkparser_app import app as chunkparser
|
33 |
-
from nltk.app.collocations_app import app as collocations
|
34 |
-
from nltk.app.concordance_app import app as concordance
|
35 |
-
from nltk.app.nemo_app import app as nemo
|
36 |
-
from nltk.app.rdparser_app import app as rdparser
|
37 |
-
from nltk.app.srparser_app import app as srparser
|
38 |
-
from nltk.app.wordnet_app import app as wordnet
|
39 |
-
|
40 |
-
try:
|
41 |
-
from matplotlib import pylab
|
42 |
-
except ImportError:
|
43 |
-
import warnings
|
44 |
-
|
45 |
-
warnings.warn("nltk.app.wordfreq not loaded (requires the matplotlib library).")
|
46 |
-
else:
|
47 |
-
from nltk.app.wordfreq_app import app as wordfreq
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pipeline/nltk/app/__pycache__/__init__.cpython-39.pyc
DELETED
Binary file (1.31 kB)
|
|
pipeline/nltk/app/__pycache__/chartparser_app.cpython-39.pyc
DELETED
Binary file (63.2 kB)
|
|
pipeline/nltk/app/__pycache__/chunkparser_app.cpython-39.pyc
DELETED
Binary file (33.4 kB)
|
|
pipeline/nltk/app/__pycache__/collocations_app.cpython-39.pyc
DELETED
Binary file (14.8 kB)
|
|
pipeline/nltk/app/__pycache__/concordance_app.cpython-39.pyc
DELETED
Binary file (22.7 kB)
|
|
pipeline/nltk/app/__pycache__/nemo_app.cpython-39.pyc
DELETED
Binary file (12.3 kB)
|
|
pipeline/nltk/app/__pycache__/rdparser_app.cpython-39.pyc
DELETED
Binary file (26 kB)
|
|
pipeline/nltk/app/__pycache__/srparser_app.cpython-39.pyc
DELETED
Binary file (22 kB)
|
|
pipeline/nltk/app/__pycache__/wordfreq_app.cpython-39.pyc
DELETED
Binary file (1.46 kB)
|
|