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.
@@ -1,3 +1,3 @@
1
- from .summarizer import TextSummarizer
2
-
3
- __version__ = "1.2.4"
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(description="Text Summarization Tool")
6
- parser.add_argument("--glove-path", default="glove.6B.100d.txt/glove.6B.100d.txt",
7
- help="Path to GloVe embeddings file")
8
- parser.add_argument("--num-sentences", type=int, default=5,
9
- help="Number of sentences in summary")
10
- parser.add_argument("--csv-file", help="Path to CSV file with articles")
11
- parser.add_argument("--article-id", type=int, help="Article ID to summarize (if CSV provided)")
12
- parser.add_argument("--gui", action="store_true", help="Launch graphical user interface")
13
-
14
- args = parser.parse_args()
15
-
16
- if args.gui:
17
- # Import and run GUI
18
- from .ui import main as gui_main
19
- gui_main()
20
- return
21
-
22
- try:
23
- summarizer = TextSummarizer(glove_path=args.glove_path, num_sentences=args.num_sentences)
24
-
25
- if args.csv_file:
26
- import pandas as pd
27
- df = pd.read_csv(args.csv_file)
28
- scored_sentences = summarizer.run_summarization(df)
29
-
30
- if args.article_id:
31
- article_text, summary = summarizer.summarize_article(scored_sentences, args.article_id, df)
32
- if article_text and summary:
33
- print("ARTICLE:")
34
- print(article_text)
35
- print('\nSUMMARY:')
36
- print(summary)
37
- else:
38
- print(f"Article ID {args.article_id} not found.")
39
- else:
40
- summaries = summarizer.summarize_all_articles(scored_sentences, df)
41
- for article_id, data in summaries.items():
42
- print(f"Processing Article ID: {article_id}")
43
- print("ARTICLE:")
44
- print(data['article'])
45
- print('\nSUMMARY:')
46
- print(data['summary'])
47
- print('\n')
48
- else:
49
- # Interactive mode
50
- df = summarizer.load_data()
51
- if df.empty:
52
- return
53
-
54
- scored_sentences = summarizer.run_summarization(df)
55
-
56
- while True:
57
- choice = input("Enter 'S' for a particular article or 'M' for all articles: ").upper()
58
- if choice == 'S':
59
- try:
60
- article_id = int(input("Enter Article ID: "))
61
- article_text, summary = summarizer.summarize_article(scored_sentences, article_id, df)
62
- if article_text and summary:
63
- print("ARTICLE:")
64
- print(article_text)
65
- print('\nSUMMARY:')
66
- print(summary)
67
- else:
68
- print(f"Article ID {article_id} not found.")
69
- except ValueError:
70
- print("Invalid Article ID.")
71
- break
72
- elif choice == 'M':
73
- summaries = summarizer.summarize_all_articles(scored_sentences, df)
74
- for article_id, data in summaries.items():
75
- print(f"Processing Article ID: {article_id}")
76
- print("ARTICLE:")
77
- print(data['article'])
78
- print('\nSUMMARY:')
79
- print(data['summary'])
80
- print('\n')
81
- break
82
- else:
83
- print("Invalid choice. Please enter 'S' or 'M'.")
84
-
85
- except Exception as e:
86
- print(f"Error: {e}")
87
-
88
- if __name__ == "__main__":
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()