Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-158
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2022-158
2022-158
Commits
7d67b62f
Commit
7d67b62f
authored
Oct 09, 2022
by
Jayasith H.B.C
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'IT19079264'
Master See merge request
!105
parents
79d4d5bd
7bcede41
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
28 deletions
+28
-28
backend/database.db
backend/database.db
+0
-0
backend/services/class_diagram_generation_service.py
backend/services/class_diagram_generation_service.py
+1
-1
backend/services/question_preprocess_service.py
backend/services/question_preprocess_service.py
+17
-21
backend/services/tokenization_service.py
backend/services/tokenization_service.py
+10
-6
backend/submissions/use_case/test18.jpg
backend/submissions/use_case/test18.jpg
+0
-0
No files found.
backend/database.db
View file @
7d67b62f
No preview for this file type
backend/services/class_diagram_generation_service.py
View file @
7d67b62f
...
...
@@ -53,7 +53,7 @@ def generate_diagram(filename):
print
(
Exception
)
# generate python file for the class
# generate python file for the class
(pyreverse)
def
generate_class
(
actors
,
data
):
res
=
create_class_methods
(
data
)
class_string_arr
=
generate_class_string_array
(
actors
,
res
)
...
...
backend/services/question_preprocess_service.py
View file @
7d67b62f
...
...
@@ -11,15 +11,10 @@ def remove_unwanted_values(data):
return
data
# removing duplicates
def
remove_duplicates
(
data
):
return
list
(
set
(
data
))
# punctuation removal
# punctuation removing
def
remove_punctuation
(
sentence
):
text_
no_punct
=
[
token
for
token
in
sentence
if
not
token
.
is_punct
]
cleaned_sentence
=
' '
.
join
(
token
.
text
for
token
in
text_
no_punct
)
text_
without_punctuation
=
[
token
for
token
in
sentence
if
not
token
.
is_punct
]
cleaned_sentence
=
' '
.
join
(
token
.
text
for
token
in
text_
without_punctuation
)
return
cleaned_sentence
...
...
@@ -37,44 +32,45 @@ def main(scenario, assignment_type):
del
sentences
[
-
1
]
# creating required lists
n
c
=
[]
n
ouns_pronouns
=
[]
cleaned_extracted_actions
=
[]
cleaned_sentences
=
[]
splitted_actions_array
=
[]
splitted_actions_a
nd_actor_a
rray
=
[]
# looping through each sentence
for
sentence
in
sentences
:
# getting actors using nouns pronouns
res
=
get_nouns_pronouns
(
sentence
)
n
c
.
append
(
str
(
res
))
n
ouns_pronouns
.
append
(
str
(
res
))
cleaned_sentence
=
remove_punctuation
(
sentence
)
cleaned_sentences
.
append
(
cleaned_sentence
)
splitted_actions
=
split_actions
(
str
(
cleaned_sentence
))
splitted_actions_a
rray
.
append
(
splitted_actions
)
splitted_actions
_and_actor
=
split_actions
(
str
(
cleaned_sentence
))
splitted_actions_a
nd_actor_array
.
append
(
splitted_actions_and_actor
)
extracted_actions
=
get_actions
(
splitted_actions
)
extracted_actions
=
get_actions
(
splitted_actions
_and_actor
)
if
extracted_actions
is
not
None
:
cleaned_extracted_actions
.
append
(
extracted_actions
)
# remove duplicates of the actors
n
c
=
list
(
dict
.
fromkeys
(
nc
))
data
=
remove_unwanted_values
(
nc
)
n
ouns_pronouns
=
list
(
dict
.
fromkeys
(
nouns_pronouns
))
actors
=
remove_unwanted_values
(
nouns_pronouns
)
extracted_relationships
=
get_include_extend_relationships
(
splitted_actions_array
)
extracted_relationships
=
get_include_extend_relationships
(
splitted_actions_a
nd_actor_a
rray
)
actors_and_use_cases_array
=
identify_use_cases
(
cleaned_extracted_actions
)
if
assignment_type
==
1
:
generated_usecase_diagram_path
=
generate_use_case_diagram
(
data
,
extracted_relationships
,
generated_usecase_diagram_path
=
generate_use_case_diagram
(
actors
,
extracted_relationships
,
actors_and_use_cases_array
)
return
generated_usecase_diagram_path
elif
assignment_type
==
2
:
generated_class_diagram_path
=
generate_class
(
data
,
cleaned_extracted_actions
)
generated_class_diagram_path
=
generate_class
(
actors
,
cleaned_extracted_actions
)
return
generated_class_diagram_path
elif
assignment_type
==
3
:
generated_class_diagram_path
=
generate_class
(
data
,
cleaned_extracted_actions
)
generated_usecase_diagram_path
=
generate_use_case_diagram
(
data
,
extracted_relationships
,
generated_class_diagram_path
=
generate_class
(
actors
,
cleaned_extracted_actions
)
generated_usecase_diagram_path
=
generate_use_case_diagram
(
actors
,
extracted_relationships
,
actors_and_use_cases_array
)
return
generated_class_diagram_path
,
generated_usecase_diagram_path
backend/services/tokenization_service.py
View file @
7d67b62f
...
...
@@ -24,12 +24,14 @@ def get_nouns_pronouns(sentence):
return
token
# removing punctuations
def
remove_punctuation
(
sentence
):
text_no_punct
=
[
token
for
token
in
sentence
if
not
token
.
is_punct
]
cleaned_sentence
=
' '
.
join
(
token
.
text
for
token
in
text_no_punct
)
return
cleaned_sentence
# get actions and actors
def
split_actions
(
sentence
):
split_string
=
"should be able to "
if
split_string
in
sentence
:
...
...
@@ -37,16 +39,18 @@ def split_actions(sentence):
return
extracted_string
def
get_actions
(
splitted_action
):
# get
def
get_actions
(
splitted_action_and_actor
):
temp_array
=
[]
if
splitted_action
is
not
None
and
'|'
in
splitted_action
[
1
]:
res
=
splitted_action
[
1
]
.
split
(
' | '
)
# print('res',res)
temp_array
.
append
(
splitted_action
[
0
])
if
splitted_action
_and_actor
is
not
None
and
'|'
in
splitted_action_and_actor
[
1
]:
res
=
splitted_action
_and_actor
[
1
]
.
split
(
' | '
)
temp_array
.
append
(
splitted_action
_and_actor
[
0
])
temp_array
.
append
(
res
[
0
])
print
(
temp_array
)
return
temp_array
else
:
return
splitted_action
return
splitted_action
_and_actor
def
get_sentences
(
text
):
...
...
backend/submissions/use_case/test18.jpg
0 → 100644
View file @
7d67b62f
51.1 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment