text-summarizer-aweebtaku 1.2.4__py3-none-any.whl → 1.2.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- text_summarizer/__init__.py +3 -3
- text_summarizer/cli.py +96 -88
- text_summarizer/create_shortcuts.py +63 -63
- text_summarizer/summarizer.py +322 -322
- text_summarizer/ui.py +379 -379
- {text_summarizer_aweebtaku-1.2.4.dist-info/licenses → text_summarizer_aweebtaku-1.2.6.dist-info}/LICENSE +20 -20
- {text_summarizer_aweebtaku-1.2.4.dist-info → text_summarizer_aweebtaku-1.2.6.dist-info}/METADATA +206 -207
- text_summarizer_aweebtaku-1.2.6.dist-info/RECORD +12 -0
- {text_summarizer_aweebtaku-1.2.4.dist-info → text_summarizer_aweebtaku-1.2.6.dist-info}/WHEEL +1 -1
- text_summarizer/data/tennis.csv +0 -9
- text_summarizer_aweebtaku-1.2.4.dist-info/RECORD +0 -13
- {text_summarizer_aweebtaku-1.2.4.dist-info → text_summarizer_aweebtaku-1.2.6.dist-info}/entry_points.txt +0 -0
- {text_summarizer_aweebtaku-1.2.4.dist-info → text_summarizer_aweebtaku-1.2.6.dist-info}/top_level.txt +0 -0
text_summarizer/__init__.py
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
from .summarizer import TextSummarizer
|
|
2
|
-
|
|
3
|
-
__version__ = "1.2.
|
|
1
|
+
from .summarizer import TextSummarizer
|
|
2
|
+
|
|
3
|
+
__version__ = "1.2.6"
|
text_summarizer/cli.py
CHANGED
|
@@ -1,89 +1,97 @@
|
|
|
1
|
-
import argparse
|
|
2
|
-
from .summarizer import TextSummarizer
|
|
3
|
-
|
|
4
|
-
def main():
|
|
5
|
-
parser = argparse.ArgumentParser(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
print(
|
|
43
|
-
print(
|
|
44
|
-
print(
|
|
45
|
-
|
|
46
|
-
print(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
print(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
import argparse
|
|
2
|
+
from .summarizer import TextSummarizer
|
|
3
|
+
|
|
4
|
+
def main():
|
|
5
|
+
parser = argparse.ArgumentParser(
|
|
6
|
+
description="Text Summarization Tool",
|
|
7
|
+
epilog="""
|
|
8
|
+
Examples:
|
|
9
|
+
text-summarizer-aweebtaku --csv-file data.csv --article-id 1
|
|
10
|
+
text-summarizer-aweebtaku --gui
|
|
11
|
+
|
|
12
|
+
Desktop Shortcuts (Windows):
|
|
13
|
+
text-summarizer-shortcuts # Create desktop shortcuts
|
|
14
|
+
text-summarizer-gui # Launch graphical interface
|
|
15
|
+
|
|
16
|
+
Upgrade:
|
|
17
|
+
pip install --upgrade text-summarizer-aweebtaku
|
|
18
|
+
""",
|
|
19
|
+
formatter_class=argparse.RawDescriptionHelpFormatter
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
args = parser.parse_args()
|
|
23
|
+
|
|
24
|
+
if args.gui:
|
|
25
|
+
# Import and run GUI
|
|
26
|
+
from .ui import main as gui_main
|
|
27
|
+
gui_main()
|
|
28
|
+
return
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
summarizer = TextSummarizer(glove_path=args.glove_path, num_sentences=args.num_sentences)
|
|
32
|
+
|
|
33
|
+
if args.csv_file:
|
|
34
|
+
import pandas as pd
|
|
35
|
+
df = pd.read_csv(args.csv_file)
|
|
36
|
+
scored_sentences = summarizer.run_summarization(df)
|
|
37
|
+
|
|
38
|
+
if args.article_id:
|
|
39
|
+
article_text, summary = summarizer.summarize_article(scored_sentences, args.article_id, df)
|
|
40
|
+
if article_text and summary:
|
|
41
|
+
print("ARTICLE:")
|
|
42
|
+
print(article_text)
|
|
43
|
+
print('\nSUMMARY:')
|
|
44
|
+
print(summary)
|
|
45
|
+
else:
|
|
46
|
+
print(f"Article ID {args.article_id} not found.")
|
|
47
|
+
else:
|
|
48
|
+
summaries = summarizer.summarize_all_articles(scored_sentences, df)
|
|
49
|
+
for article_id, data in summaries.items():
|
|
50
|
+
print(f"Processing Article ID: {article_id}")
|
|
51
|
+
print("ARTICLE:")
|
|
52
|
+
print(data['article'])
|
|
53
|
+
print('\nSUMMARY:')
|
|
54
|
+
print(data['summary'])
|
|
55
|
+
print('\n')
|
|
56
|
+
else:
|
|
57
|
+
# Interactive mode
|
|
58
|
+
df = summarizer.load_data()
|
|
59
|
+
if df.empty:
|
|
60
|
+
return
|
|
61
|
+
|
|
62
|
+
scored_sentences = summarizer.run_summarization(df)
|
|
63
|
+
|
|
64
|
+
while True:
|
|
65
|
+
choice = input("Enter 'S' for a particular article or 'M' for all articles: ").upper()
|
|
66
|
+
if choice == 'S':
|
|
67
|
+
try:
|
|
68
|
+
article_id = int(input("Enter Article ID: "))
|
|
69
|
+
article_text, summary = summarizer.summarize_article(scored_sentences, article_id, df)
|
|
70
|
+
if article_text and summary:
|
|
71
|
+
print("ARTICLE:")
|
|
72
|
+
print(article_text)
|
|
73
|
+
print('\nSUMMARY:')
|
|
74
|
+
print(summary)
|
|
75
|
+
else:
|
|
76
|
+
print(f"Article ID {article_id} not found.")
|
|
77
|
+
except ValueError:
|
|
78
|
+
print("Invalid Article ID.")
|
|
79
|
+
break
|
|
80
|
+
elif choice == 'M':
|
|
81
|
+
summaries = summarizer.summarize_all_articles(scored_sentences, df)
|
|
82
|
+
for article_id, data in summaries.items():
|
|
83
|
+
print(f"Processing Article ID: {article_id}")
|
|
84
|
+
print("ARTICLE:")
|
|
85
|
+
print(data['article'])
|
|
86
|
+
print('\nSUMMARY:')
|
|
87
|
+
print(data['summary'])
|
|
88
|
+
print('\n')
|
|
89
|
+
break
|
|
90
|
+
else:
|
|
91
|
+
print("Invalid choice. Please enter 'S' or 'M'.")
|
|
92
|
+
|
|
93
|
+
except Exception as e:
|
|
94
|
+
print(f"Error: {e}")
|
|
95
|
+
|
|
96
|
+
if __name__ == "__main__":
|
|
89
97
|
main()
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Create desktop shortcuts for Text Summarizer on Windows.
|
|
4
|
-
Run this after installing the text-summarizer-aweebtaku package.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import os
|
|
8
|
-
import sys
|
|
9
|
-
import platform
|
|
10
|
-
|
|
11
|
-
def create_shortcuts():
|
|
12
|
-
"""Create desktop shortcuts for Text Summarizer GUI and CLI."""
|
|
13
|
-
|
|
14
|
-
if platform.system() != "Windows":
|
|
15
|
-
print("This script is designed for Windows only.")
|
|
16
|
-
print("On other platforms, use the console scripts:")
|
|
17
|
-
print(" text-summarizer-gui # Launch GUI")
|
|
18
|
-
print(" text-summarizer-aweebtaku --help # CLI help")
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
try:
|
|
22
|
-
import winshell
|
|
23
|
-
from win32com.client import Dispatch
|
|
24
|
-
except ImportError:
|
|
25
|
-
print("Required modules not found. Installing...")
|
|
26
|
-
os.system(f"{sys.executable} -m pip install pywin32 winshell")
|
|
27
|
-
try:
|
|
28
|
-
import winshell
|
|
29
|
-
from win32com.client import Dispatch
|
|
30
|
-
except ImportError:
|
|
31
|
-
print("Failed to install required modules.")
|
|
32
|
-
print("Please install manually: pip install pywin32 winshell")
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
desktop = winshell.desktop()
|
|
36
|
-
|
|
37
|
-
# Create GUI shortcut
|
|
38
|
-
gui_shortcut_path = os.path.join(desktop, "Text Summarizer GUI.lnk")
|
|
39
|
-
shell = Dispatch('WScript.Shell')
|
|
40
|
-
shortcut = shell.CreateShortCut(gui_shortcut_path)
|
|
41
|
-
shortcut.Targetpath = sys.executable
|
|
42
|
-
shortcut.Arguments = '-c "import text_summarizer.ui; text_summarizer.ui.main()"'
|
|
43
|
-
shortcut.WorkingDirectory = os.path.expanduser("~")
|
|
44
|
-
shortcut.IconLocation = sys.executable + ",0"
|
|
45
|
-
shortcut.Description = "Text Summarizer GUI - Extractive text summarization tool"
|
|
46
|
-
shortcut.save()
|
|
47
|
-
|
|
48
|
-
# Create CLI shortcut
|
|
49
|
-
cli_shortcut_path = os.path.join(desktop, "Text Summarizer CLI.lnk")
|
|
50
|
-
shortcut = shell.CreateShortCut(cli_shortcut_path)
|
|
51
|
-
shortcut.Targetpath = "cmd.exe"
|
|
52
|
-
shortcut.Arguments = '/k text-summarizer-aweebtaku --help'
|
|
53
|
-
shortcut.WorkingDirectory = os.path.expanduser("~")
|
|
54
|
-
shortcut.IconLocation = "cmd.exe,0"
|
|
55
|
-
shortcut.Description = "Text Summarizer CLI - Command line interface"
|
|
56
|
-
shortcut.save()
|
|
57
|
-
|
|
58
|
-
print("Desktop shortcuts created successfully!")
|
|
59
|
-
print(f"GUI Shortcut: {gui_shortcut_path}")
|
|
60
|
-
print(f"CLI Shortcut: {cli_shortcut_path}")
|
|
61
|
-
print("\nYou can now double-click these shortcuts to launch the application.")
|
|
62
|
-
|
|
63
|
-
if __name__ == "__main__":
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Create desktop shortcuts for Text Summarizer on Windows.
|
|
4
|
+
Run this after installing the text-summarizer-aweebtaku package.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
import sys
|
|
9
|
+
import platform
|
|
10
|
+
|
|
11
|
+
def create_shortcuts():
|
|
12
|
+
"""Create desktop shortcuts for Text Summarizer GUI and CLI."""
|
|
13
|
+
|
|
14
|
+
if platform.system() != "Windows":
|
|
15
|
+
print("This script is designed for Windows only.")
|
|
16
|
+
print("On other platforms, use the console scripts:")
|
|
17
|
+
print(" text-summarizer-gui # Launch GUI")
|
|
18
|
+
print(" text-summarizer-aweebtaku --help # CLI help")
|
|
19
|
+
return
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
import winshell
|
|
23
|
+
from win32com.client import Dispatch
|
|
24
|
+
except ImportError:
|
|
25
|
+
print("Required modules not found. Installing...")
|
|
26
|
+
os.system(f"{sys.executable} -m pip install pywin32 winshell")
|
|
27
|
+
try:
|
|
28
|
+
import winshell
|
|
29
|
+
from win32com.client import Dispatch
|
|
30
|
+
except ImportError:
|
|
31
|
+
print("Failed to install required modules.")
|
|
32
|
+
print("Please install manually: pip install pywin32 winshell")
|
|
33
|
+
return
|
|
34
|
+
|
|
35
|
+
desktop = winshell.desktop()
|
|
36
|
+
|
|
37
|
+
# Create GUI shortcut
|
|
38
|
+
gui_shortcut_path = os.path.join(desktop, "Text Summarizer GUI.lnk")
|
|
39
|
+
shell = Dispatch('WScript.Shell')
|
|
40
|
+
shortcut = shell.CreateShortCut(gui_shortcut_path)
|
|
41
|
+
shortcut.Targetpath = sys.executable
|
|
42
|
+
shortcut.Arguments = '-c "import text_summarizer.ui; text_summarizer.ui.main()"'
|
|
43
|
+
shortcut.WorkingDirectory = os.path.expanduser("~")
|
|
44
|
+
shortcut.IconLocation = sys.executable + ",0"
|
|
45
|
+
shortcut.Description = "Text Summarizer GUI - Extractive text summarization tool"
|
|
46
|
+
shortcut.save()
|
|
47
|
+
|
|
48
|
+
# Create CLI shortcut
|
|
49
|
+
cli_shortcut_path = os.path.join(desktop, "Text Summarizer CLI.lnk")
|
|
50
|
+
shortcut = shell.CreateShortCut(cli_shortcut_path)
|
|
51
|
+
shortcut.Targetpath = "cmd.exe"
|
|
52
|
+
shortcut.Arguments = '/k text-summarizer-aweebtaku --help'
|
|
53
|
+
shortcut.WorkingDirectory = os.path.expanduser("~")
|
|
54
|
+
shortcut.IconLocation = "cmd.exe,0"
|
|
55
|
+
shortcut.Description = "Text Summarizer CLI - Command line interface"
|
|
56
|
+
shortcut.save()
|
|
57
|
+
|
|
58
|
+
print("Desktop shortcuts created successfully!")
|
|
59
|
+
print(f"GUI Shortcut: {gui_shortcut_path}")
|
|
60
|
+
print(f"CLI Shortcut: {cli_shortcut_path}")
|
|
61
|
+
print("\nYou can now double-click these shortcuts to launch the application.")
|
|
62
|
+
|
|
63
|
+
if __name__ == "__main__":
|
|
64
64
|
create_shortcuts()
|