my web page is to categories the software requirements, so it takes the requirement as input from the user and they should click the button and based on their input it should classify it as bad or good, so in
my case the “good” in the if-else. so if the
why the if-else appear anyway in the web page?
import streamlit as st
st.title(" Tool for detecting defects in software requirement specification")
x=st.text_input("write your Non-funcationl requriment", value="")
weakWords=['fast','quickly', 'easy', 'timely', 'before', 'after', 'user-friendly', 'effective', 'multiple', 'as possible', 'appropriate', 'normal', 'capability', 'reliable', 'state-of-the-art', 'effortless', 'multi']
unboundedList=['at least','more than','less than','not less than','no less than','at the minimum','always']
ambiguity=['should','may','if possible','when','when appropriate','detail','details','analyse','respond','verified']
ambiguityWeakWords=['support','relevant information','needed information']
button=st.button("click",on_click=None)
if button:
for word in weakWords:
if (word in x):
st.text("The requrement classified as: Bad\nThe wrong word: " +word+"\ncategory: Weak Words")
for word in unboundedList:
if (word in x):
st.text("The requrement classified as: Bad\nThe wrong word: " +word+"\ncategory: Unbounded List")
for word in ambiguity:
if (word in x):
st.text("The requrement classified as: Bad\nThe wrong word: " +word+"\ncategory: Ambiguity")
for word in ambiguityWeakWords:
if (word in x):
st.text("The requrement classified as: Bad\nThe wrong word: " +word+"\ncategory: Ambiguity & WeakWords")
elif(word not in x):
st.text("The requrement classified as: Good")
I was able to accomplish it using a modified code, but there is an issue with the elements in the list with multiple words such as “if possible” and “at the mininum” which I was not able to resolve quickly. You may be able to resolve it with a change on the split option, but this is not streamlit problem. Best of of luck!
if button:
count=0
x=x.split(" ")
for word in x:
#st.write(word)
if word in weakWords:
st.text("The requirement classified as: Bad\nThe wrong word: " +word+"\ncategory: Weak Words")
count+=1
elif word in unboundedList:
st.text("The requirement classified as: Bad\nThe wrong word: " +word+"\ncategory: Unbounded List")
count+=1
elif word in ambiguity:
st.text("The requirement classified as: Bad\nThe wrong word: " +word+"\ncategory: Ambiguity")
count+=1
elif word in ambiguityWeakWords:
st.text("The requirement classified as: Bad\nThe wrong word: " +word+"\ncategory: Ambiguity & WeakWords")
count+=1
if count==0:
st.text("The requirement classified as: Good")
@lama_Alrweta@cualr Not sure how familiar you are with NLP. You can apply spaCy's rule-based matcher to find phrases and show them highlighted using spaCy’s entity visualizer. Something like this:
It’s very easy so give it a go yourself. Here’s the relevant spaCy doc page. Once you have the basics in place you can build upon it by suggesting tighter, more active and precise phrasing of the requirements.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.