Anti-Gamer commited on
Commit
db02cae
·
verified ·
1 Parent(s): d58feee

Upload 5 files

Browse files

![Screenshot 2024-11-23 175624.png](https://cdn-uploads.huggingface.co/production/uploads/671143e0f79df5a3740f7122/VQ1S9JBYuue4O0B-xZtrA.png)
![Screenshot 2024-11-23 175718.png](https://cdn-uploads.huggingface.co/production/uploads/671143e0f79df5a3740f7122/Vsg_jC8RPn8ADi9Evc5o4.png)
![Screenshot 2024-11-23 175641.png](https://cdn-uploads.huggingface.co/production/uploads/671143e0f79df5a3740f7122/a-Ev5bG-K_hNt1I7oonPg.png)

Files changed (5) hide show
  1. .gitattributes +3 -35
  2. chatbot.py +89 -0
  3. long-story.txt +66 -0
  4. requirements.txt +0 -0
  5. text-preprocessing.ipynb +0 -0
.gitattributes CHANGED
@@ -1,35 +1,3 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ *.dll filter=lfs diff=lfs merge=lfs -text
2
+ *.lib filter=lfs diff=lfs merge=lfs -text
3
+ *.psd filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
chatbot.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import spacy
2
+ import unicodedata
3
+ import re
4
+ import streamlit as st
5
+ from sentence_transformers import SentenceTransformer, util
6
+
7
+ # Preprocess the text
8
+ def clean_text(text):
9
+ # Normalize Unicode characters
10
+ text = unicodedata.normalize('NFKC', text)
11
+
12
+ # Replace non-breaking or zero-width spaces with regular spaces
13
+ text = text.replace('\u200a', ' ').replace('\u00a0', ' ')
14
+
15
+ return text
16
+
17
+ # Load the SBERT model
18
+ model = SentenceTransformer('all-MiniLM-L6-v2')
19
+
20
+ # Load and clean the text file
21
+ with open('long-story.txt', encoding='utf-8') as f:
22
+ text = f.read()
23
+
24
+ cleaned_text = clean_text(text)
25
+
26
+ # Define the regular expression to match titles and the content between them
27
+ pattern = r"\n\n([A-Z\s]+)\n([^\n]+(?:\n[^\n]+)*)"
28
+
29
+ # Use findall to capture all title-content pairs
30
+ sections = re.findall(pattern, cleaned_text)
31
+
32
+ # Store the sections in a dictionary with embeddings for content
33
+ sections_dict = {}
34
+ embeddings_dict = {}
35
+
36
+ for title, content in sections:
37
+ # Clean the title and content by stripping unnecessary newlines
38
+ cleaned_title = title.strip().lower() # Convert the title to lowercase for case-insensitive matching
39
+ cleaned_content = content.strip()
40
+
41
+ # Create embeddings for each section content
42
+ content_embedding = model.encode(cleaned_content, convert_to_tensor=True)
43
+
44
+ sections_dict[cleaned_title] = cleaned_content
45
+ embeddings_dict[cleaned_title] = content_embedding
46
+
47
+ # Function to retrieve content based on user input (semantic matching with SBERT)
48
+ def get_section(user_input):
49
+ # Normalize user input to lowercase for matching
50
+ user_input = user_input.lower()
51
+
52
+ # Generate the embedding for the user input
53
+ user_input_embedding = model.encode(user_input, convert_to_tensor=True)
54
+
55
+ best_match = None
56
+ best_score = -1
57
+
58
+ # Iterate through the sections to find the best match based on cosine similarity
59
+ for title, section_embedding in embeddings_dict.items():
60
+ cosine_score = util.pytorch_cos_sim(user_input_embedding, section_embedding)[0][0].item()
61
+
62
+ if cosine_score > best_score:
63
+ best_score = cosine_score
64
+ best_match = title
65
+
66
+ # Return the best matching section
67
+ if best_score > 0.5: # You can adjust the threshold based on your needs
68
+ return sections_dict[best_match]
69
+ else:
70
+ return "No matching section found."
71
+
72
+ # Streamlit UI
73
+ def chatbot_ui():
74
+ st.title("Text-Based Chatbot")
75
+
76
+ # Display instructions
77
+ st.write("Ask the chatbot for specific sections from the document by typing keywords like 'productivity', 'life hacks', 'communication skills', 'skill development', 'personal development', 'goal setting' ")
78
+
79
+ # Input field for the user
80
+ user_input = st.text_input("Enter a keyword", "")
81
+
82
+ # If the user enters a keyword, get the matching section and display it
83
+ if user_input:
84
+ section_content = get_section(user_input)
85
+ st.write(section_content)
86
+
87
+ # Run the Streamlit app
88
+ if __name__ == "__main__":
89
+ chatbot_ui()
long-story.txt ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ IMPORTANCE OF PRODUCTIVITY
4
+ Understanding Productivity
5
+ Productivity is the cornerstone of personal development. It involves managing time and resources effectively to achieve goals. Life hacks that boost productivity allow individuals to maximize their output without compromising their well-being. Simple practices, such as creating to-do lists or utilizing digital tools, can help prioritize tasks and maintain focus.
6
+
7
+ The Pomodoro Technique
8
+ One popular productivity hack is the Pomodoro Technique. This method encourages individuals to work in focused bursts of 25 minutes followed by a five-minute break. This structured approach helps maintain concentration while preventing burnout. Over time, the technique can lead to improved efficiency and a greater sense of accomplishment.
9
+
10
+ LIFE HACKS
11
+ Networking Strategies
12
+ Networking is crucial for career growth. Effective life hacks can enhance networking efforts, such as developing an elevator pitch — a concise, engaging summary of who you are and what you do. This pitch can be used in various scenarios, helping to make a memorable impression on potential employers or collaborators.
13
+
14
+ Leveraging Digital Platforms
15
+ In today’s digital age, platforms like LinkedIn are invaluable for career advancement. Regularly updating your profile, sharing relevant content, and engaging with industry groups can significantly expand your professional network. Utilizing these platforms effectively allows individuals to stay informed about job opportunities and industry trends.
16
+
17
+
18
+ SKILL DEVELOPMENT
19
+ Embracing Online Learning
20
+ Continuous learning is essential in a rapidly changing job market. Online platforms such as Coursera, Udemy, and LinkedIn Learning offer courses across various fields, allowing individuals to acquire new skills at their own pace. This flexibility makes it easier to balance learning with other commitments.
21
+
22
+ The Value of Workshops and Seminars
23
+ Attending workshops and seminars can provide hands-on experience and valuable networking opportunities. These events often feature industry leaders sharing insights and trends, making them excellent venues for professional growth. Engaging with peers and mentors in these settings can inspire new ideas and approaches to challenges.
24
+
25
+ PERSONAL DEVELOPMENT
26
+ Emotional Intelligence
27
+ Emotional intelligence (EI) is a critical component of personal development. It involves the ability to recognize and manage one’s emotions, as well as the emotions of others. Developing EI can lead to improved relationships, better communication, and enhanced leadership abilities. Life hacks such as mindfulness practices and self-reflection exercises can help cultivate emotional awareness.
28
+
29
+ Mindfulness and Self-Reflection
30
+ Practicing mindfulness encourages individuals to stay present and engaged in their daily activities. Techniques such as meditation and journaling can promote self-reflection, allowing individuals to evaluate their goals, values, and progress. This deeper understanding can inform future decisions and foster personal growth.
31
+
32
+ GOAL SETTING
33
+ The SMART Framework
34
+ Setting clear goals is essential for personal and professional development. The SMART framework:Specific, Measurable, Achievable, Relevant, Time-bound — provides a structured approach to goal setting. By breaking larger objectives into smaller, manageable tasks, individuals can track their progress and stay motivated.
35
+
36
+ Tracking Progress
37
+ Regularly reviewing goals and progress helps maintain focus and accountability. Tools like habit trackers or goal-setting apps can provide visual representations of progress, making it easier to stay committed. Celebrating small achievements along the way can also boost motivation and reinforce positive behaviors.
38
+
39
+ TIME MANAGEMENT
40
+ The Eisenhower Matrix
41
+ Effective time management is crucial for maximizing productivity. The Eisenhower Matrix, which categorizes tasks into four quadrants based on urgency and importance, can help prioritize daily activities. By focusing on what truly matters, individuals can allocate their efforts more strategically and avoid feeling overwhelmed.
42
+
43
+ Setting Boundaries
44
+ Establishing boundaries is essential for maintaining a healthy work-life balance. Learning to say no to non-essential commitments allows individuals to focus on their priorities. Creating designated work hours and personal time can help reinforce these boundaries, leading to increased productivity and reduced stress.
45
+
46
+ Stimulating Creativity
47
+ Reading regularly can stimulate creativity and expand knowledge. Whether through fiction, non-fiction, or industry-related literature, books can provide fresh perspectives and insights. This practice enhances critical thinking skills, which are essential for both personal and professional growth.
48
+
49
+ Lifelong Learning
50
+ Cultivating a habit of reading fosters a mindset of lifelong learning. Engaging with diverse topics can lead to new ideas and innovations, benefiting both personal and career development. Setting aside time for reading each week can significantly enrich one’s understanding of the world.
51
+
52
+ COMMUNICATION SKILLS
53
+ Verbal and Written Communication
54
+ Strong communication skills are vital for career success. Effective verbal and written communication can enhance collaboration and foster positive relationships in the workplace. Life hacks such as practicing active listening and seeking feedback can help improve these skills over time.
55
+
56
+ Presentation Skills
57
+ Developing presentation skills is also crucial for career advancement. Practicing public speaking and utilizing visual aids can enhance the clarity and impact of presentations. Engaging storytelling techniques can capture an audience’s attention, making the information more memorable.
58
+
59
+ Mentorship
60
+ Establishing relationships with mentors can provide invaluable guidance and support. Mentors can share their experiences, offer advice, and help navigate career challenges. Seeking out mentors within one’s industry or professional network can lead to significant growth opportunities.
61
+
62
+ Community Engagement
63
+ Building a supportive network also involves engaging with peers. Participating in professional organizations or local networking events fosters connections with like-minded individuals. These relationships can lead to collaboration, new ideas, and a sense of belonging within one’s field.
64
+
65
+ CONCLUSION
66
+ In conclusion, life hacks play a vital role in personal development and career advancement. By implementing productivity techniques, embracing continuous learning, and focusing on emotional intelligence, individuals can navigate the complexities of modern life with greater ease. Effective goal setting, time management, and communication skills further enhance these efforts, leading to a more balanced and fulfilling life. Ultimately, the integration of these strategies fosters a growth mindset, empowering individuals to achieve their personal and professional aspirations.
requirements.txt ADDED
Binary file (3.46 kB). View file
 
text-preprocessing.ipynb ADDED
The diff for this file is too large to render. See raw diff