Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020-077
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
2020-077
2020-077
Commits
e4eef220
Commit
e4eef220
authored
Dec 01, 2020
by
G.M. Amashi S. Bastiansz
🎯
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'amashi_dev' of
http://gitlab.sliit.lk/2020_077/2020_077
into amashi_dev
parents
a5b80859
6abb1837
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
154 additions
and
152 deletions
+154
-152
reveng/checkCommon.py
reveng/checkCommon.py
+13
-13
reveng/firebaseConfig.py
reveng/firebaseConfig.py
+11
-11
reveng/getImages.py
reveng/getImages.py
+36
-36
reveng/gifDisplay.py
reveng/gifDisplay.py
+22
-21
reveng/gifDisplayMain.py
reveng/gifDisplayMain.py
+9
-9
reveng/gifMaker.py
reveng/gifMaker.py
+20
-19
reveng/processInput.py
reveng/processInput.py
+28
-28
reveng/processSentence.py
reveng/processSentence.py
+15
-15
No files found.
reveng/checkCommon.py
View file @
e4eef220
"""
This file is used as a main file for the user-inputs which have same words/sentences
appears in common.json file
###
#
This file is used as a main file for the user-inputs which have same words/sentences
#
appears in common.json file
@author Amashi Bastiansz | IT17143950
@version 1.2
@since 2020-07-30
"""
#
@author Amashi Bastiansz | IT17143950
#
@version 1.2
#
@since 2020-07-30
###
import
json
import
os
...
...
@@ -18,13 +18,13 @@ jsonPath = os.path.join(REVENG, 'common.json')
def
checkInJson
(
message
):
"""
# This method is used to create a GIF image for the user-input which is similar
with a sentence appears in common.json file
###
# This method is used to create a GIF image for the user-input which is similar
#
with a sentence appears in common.json file
# Also, this method is used to create a GIF image for the user-input which is similar
with a word appears in common.json file
"""
# Also, this method is used to create a GIF image for the user-input which is similar
#
with a word appears in common.json file
###
# convert user-input into lowercase
message
=
message
.
lower
()
...
...
reveng/firebaseConfig.py
View file @
e4eef220
"""
This file is used to create firbase configuration for the application
###
#
This file is used to create firbase configuration for the application
Each application has unique firbase configuration.
#
Each application has unique firbase configuration.
@author Amashi Bastiansz | IT17143950
@version 1.0
@since 2020-08-13
"""
#
@author Amashi Bastiansz | IT17143950
#
@version 1.0
#
@since 2020-08-13
###
import
json
import
os
...
...
@@ -47,10 +47,10 @@ store = firebase.storage()
def
getStorageInstance
():
"""
This method is used to redirect to the firebase cloud storage
###
#
This method is used to redirect to the firebase cloud storage
@return Firebase Cloud Storage
"""
#
@return Firebase Cloud Storage
###
return
store
reveng/getImages.py
View file @
e4eef220
"""
This file is used to fetch images of the hand signs from the system database
###
#
This file is used to fetch images of the hand signs from the system database
@author Amashi Bastiansz | IT17143950
@version 1.6
@since 2020-08-30
"""
#
@author Amashi Bastiansz | IT17143950
#
@version 1.6
#
@since 2020-08-30
###
import
json
import
os
...
...
@@ -23,14 +23,14 @@ store = getStorageInstance()
def
getImagesCommonWord
(
message
):
"""
This method is used to select hand signs for user-entered text
###
#
This method is used to select hand signs for user-entered text
These hand signs are for the words in the common_word section in the
common.json file
#
These hand signs are for the words in the common_word section in the
#
common.json file
@return call to generateGIF() method with selected hand images
"""
#
@return call to generateGIF() method with selected hand images
###
images
=
store
.
child
()
.
list_files
()
imageRes
=
[]
...
...
@@ -50,17 +50,17 @@ def getImagesCommonWord(message):
def
getImagesForCommonWord
(
message
):
"""
This method is used to select hand signs for user-entered text
###
#
This method is used to select hand signs for user-entered text
These hand signs are for the words in the common_word section in the
common.json file
#
These hand signs are for the words in the common_word section in the
#
common.json file
This method is specifically made for the words which may have more than one hand sign
in the sign language (the words which are need multiple signs to show one verbal word)
#
This method is specifically made for the words which may have more than one hand sign
#
in the sign language (the words which are need multiple signs to show one verbal word)
@return call to generateGIF() method with selected hand images
"""
#
@return call to generateGIF() method with selected hand images
###
images
=
store
.
child
()
.
list_files
()
imageRes
=
[]
...
...
@@ -80,12 +80,12 @@ def getImagesForCommonWord(message):
def
getImagesForRareWord
(
message
):
"""
This method is used to select hand signs for user-entered text
which is not appeared in common.json file
###
#
This method is used to select hand signs for user-entered text
#
which is not appeared in common.json file
@return call to generateGIF() method with selected hand images
"""
#
@return call to generateGIF() method with selected hand images
###
images
=
store
.
child
()
.
list_files
()
imageRes
=
[]
...
...
@@ -105,12 +105,12 @@ def getImagesForRareWord(message):
def
getImagesRareWord
(
message
):
"""
This method is used to select hand signs for user-entered text
which is not appeared in common.json file
###
#
This method is used to select hand signs for user-entered text
#
which is not appeared in common.json file
@return call to generateGIF() method with selected hand images
"""
#
@return call to generateGIF() method with selected hand images
###
images
=
store
.
child
()
.
list_files
()
imageRes
=
[]
...
...
@@ -130,14 +130,14 @@ def getImagesRareWord(message):
def
getImagesCommonSentence
(
sentence
):
"""
This method is used to select hand signs for user-entered sentence
###
#
This method is used to select hand signs for user-entered sentence
These hand signs are for the sentences in the common_sentence section in the
common.json file
#
These hand signs are for the sentences in the common_sentence section in the
#
common.json file
@return call to generateGIF() method with selected hand images
"""
#
@return call to generateGIF() method with selected hand images
###
sendingToGIF
=
[]
imageRes
=
[]
...
...
reveng/gifDisplay.py
View file @
e4eef220
"""
This file is used to display the created GIF to user
This file is still at TESTING PHASE
###
# This file is used to display the created GIF to user
@author Amashi Bastiansz | IT17143950
@version 1.2
@since 2020-10-01
"""
# This file is still at TESTING PHASE
# @author Amashi Bastiansz | IT17143950
# @version 1.2
# @since 2020-10-01
###
import
os
import
urllib.request
...
...
@@ -22,23 +22,23 @@ app = Flask(__name__)
def
allowed_file
(
filename
):
"""
This method is used check the extension of selected file
###
#
This method is used check the extension of selected file
@return the extension to check whether it is allowed
"""
#
@return the extension to check whether it is allowed
###
return
'.'
in
filename
and
filename
.
rsplit
(
'.'
,
1
)[
1
]
.
lower
()
in
ALLOWED_EXTENSIONS
@
app
.
route
(
'/'
,
methods
=
[
'POST'
])
def
upload_image
():
"""
This method is used upload the selected file to the exact folder
after checking whether the extensions are matched.
###
# This method is used upload the selected file to the exact folder
#
after checking whether the extensions are matched.
@return redirect to upload.html
"""
#
@return redirect to upload.html
###
if
'file'
not
in
request
.
files
:
flash
(
'No file part'
)
...
...
@@ -59,11 +59,12 @@ def upload_image():
@
app
.
route
(
'/display/<filename>'
)
def
display_image
(
filename
):
"""
This method is used display the uploaded file back to the user
###
# This method is used display the uploaded file back to the user
# @return display the file in the interface
###
@return display the file in the interface
"""
return
redirect
(
url_for
(
'static'
,
filename
=
'uploads/'
+
filename
),
code
=
301
)
...
...
reveng/gifDisplayMain.py
View file @
e4eef220
"""
This file is used to display the created GIF to the user on the interface
Still in TESTING phase
@author Amashi Bastiansz | IT17143950
@version 1.5
@since 2020-10-01
"""
###
#
This file is used to display the created GIF to the user on the interface
#
Still in TESTING phase
#
@author Amashi Bastiansz | IT17143950
#
@version 1.5
# @since 2020-10-01
###
from
flask
import
Flask
...
...
reveng/gifMaker.py
View file @
e4eef220
"""
This file is used to:
###
#
This file is used to:
# generate a GIF image
# send the generated GIF to the folder
# delete the GIF from cache
@author Amashi Bastiansz | IT17143950
@version 1.5
@since 2020-10-01
"""
#
@author Amashi Bastiansz | IT17143950
#
@version 1.5
#
@since 2020-10-01
###
import
imageio
import
os
...
...
@@ -24,11 +24,11 @@ gifName = ''.join(random.choices(string.ascii_uppercase +
def
generateGIF
(
images
):
"""
This method is used to generate a path for the created GIF image
###
#
This method is used to generate a path for the created GIF image
@return the generated GIF path
"""
#
@return the generated GIF path
###
gifPath
=
os
.
path
.
join
(
PATH
+
"
\\
output
\\
"
+
gifName
+
'.gif'
)
imageio
.
mimwrite
(
gifPath
,
images
,
duration
=
0.5
)
...
...
@@ -37,19 +37,20 @@ def generateGIF(images):
def
sendGIF
():
"""
This method is used to send the generated GIF to the exact folder to store it
"""
###
#
This method is used to send the generated GIF to the exact folder to store it
###
x
=
imageio
.
mimread
(
os
.
path
.
join
(
PATH
+
"
\\
output
\\
"
+
gifName
+
'.gif'
))
return
x
def
deleteFromCache
():
"""
This method is used to delete the generated GIF from cache after uploading it to
the exact project folder
###
#
This method is used to delete the generated GIF from cache after uploading it to
#
the exact project folder
@return call to generateGIF() method with selected hand images
"""
# @return call to generateGIF() method with selected hand images
###
os
.
remove
(
os
.
path
.
join
(
PATH
+
"
\\
output
\\
"
+
gifName
+
'.gif'
))
reveng/processInput.py
View file @
e4eef220
"""
This file is used to process the user-entered input
###
#
This file is used to process the user-entered input
Through the methods in this file, the system will apply different Tokenization techniques
(in NLP) in order to make the input more identifiable
#
Through the methods in this file, the system will apply different Tokenization techniques
#
(in NLP) in order to make the input more identifiable
@author Amashi Bastiansz | IT17143950
@version 1.4
@since 2020-07-15
"""
#
@author Amashi Bastiansz | IT17143950
#
@version 1.4
#
@since 2020-07-15
###
import
os
import
json
...
...
@@ -24,10 +24,10 @@ from reveng.gifMaker import generateGIF
def
checkCommon
(
message
):
"""
This method is used to return the checkInJson() method in checkCommon.py file
"""
###
#
This method is used to return the checkInJson() method in checkCommon.py file
###
return
checkInJson
(
message
)
...
...
@@ -40,13 +40,13 @@ jsonPath = os.path.join(REVENG, 'common.json')
def
checkInCommonSentence
(
sentence
):
"""
# This method is used to compare the user-input with common_sentence
section in common.json file
###
# This method is used to compare the user-input with common_sentence
#
section in common.json file
#If a similar setence appear in common_sentence section in common.json
file the method will return true
"""
#If a similar setence appear in common_sentence section in common.json
#
file the method will return true
###
with
open
(
jsonPath
)
as
jsonfile
:
data
=
json
.
load
(
jsonfile
)
...
...
@@ -61,13 +61,13 @@ def checkInCommonSentence(sentence):
def
checkInCommonWord
(
word
):
"""
This method is used to compare the user-input with common_words
section in common.json file
###
#
This method is used to compare the user-input with common_words
#
section in common.json file
If a similar setence appear in common_word section in common.json
file the method will return true
"""
#
If a similar setence appear in common_word section in common.json
#
file the method will return true
###
with
open
(
jsonPath
)
as
jsonfile
:
data
=
json
.
load
(
jsonfile
)
...
...
@@ -82,10 +82,10 @@ def checkInCommonWord(word):
def
processInput
(
message
):
"""
This method is used to send the fetched hand images to generateGIF()
method to create the final GIF image
"""
###
#
This method is used to send the fetched hand images to generateGIF()
#
method to create the final GIF image
###
message
=
message
.
lower
()
if
len
(
message
.
split
(
" "
))
>=
2
:
...
...
reveng/processSentence.py
View file @
e4eef220
"""
This file is used to check a user-entered sentence with json file
and return the relevant GIF image
###
#
This file is used to check a user-entered sentence with json file
#
and return the relevant GIF image
@author Amashi Bastiansz | IT17143950
@version 2.0
@since 2020-07-15
"""
#
@author Amashi Bastiansz | IT17143950
#
@version 2.0
#
@since 2020-07-15
###
import
json
import
os
...
...
@@ -16,10 +16,10 @@ REVENG = os.path.dirname(os.path.abspath(__file__))
def
processCommonSentence
(
message
):
"""
This method is used to process a sentence which has similar sentences in common.json file
and to return the GIF
"""
###
#
This method is used to process a sentence which has similar sentences in common.json file
#
and to return the GIF
###
splitMessage
=
message
.
split
(
" "
)
gif
=
getImagesCommonSentence
(
splitMessage
)
...
...
@@ -27,10 +27,10 @@ def processCommonSentence(message):
def
processRareSentence
(
message
):
"""
This method is used to process a sentence which does not have similar sentences in common.json file
and to return the GIF
"""
###
#
This method is used to process a sentence which does not have similar sentences in common.json file
#
and to return the GIF
###
splitMessage
=
message
.
split
(
" "
)
gif
=
getImagesCommonSentence
(
splitMessage
)
...
...
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