-
Notifications
You must be signed in to change notification settings - Fork 6
KWIC Functionality added! #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
harisalam
wants to merge
5
commits into
hvkone:master
Choose a base branch
from
harisalam:newFeature20210423
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bf160d4
Need interation of KWIC functionality with webapp
harisalam 88fb9cd
app.py
Akhilraj03-Github a3c61f5
Merge branch 'master' into newFeature20210423
Akhilraj03-Github 2c01a55
Update app.py
Akhilraj03-Github 87b4365
KWIC.py
Akhilraj03-Github File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| requests==2.25.1 | ||
| nltk==3.5 | ||
| numpy==1.20.1 | ||
| numpy~=1.19.2 | ||
| beautifulsoup4==4.9.3 | ||
| corpy==0.3.0 | ||
| Flask==1.1.2 | ||
| gensim==3.8.3 | ||
| pymysql==1.0.2 | ||
| scikit_learn==0.24.1 | ||
| pysolr-3.9.0 | ||
| pysolr-3.9.0 | ||
| mysql~=5.7.24 | ||
| scikit-learn~=0.24.1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,7 +79,7 @@ def database(self): | |
| db_host=db_config['db_host'], | ||
| db_name=db_config['db_name']) | ||
| self.cursor = self.store_data.db_connect().cursor() | ||
| query_info = "SELECT sentence FROM english_sentences" | ||
| query_info = "SELECT sentence FROM English_sentences" | ||
| self.cursor.execute(query_info) | ||
| sentences_df = pd.DataFrame(self.cursor.fetchall(), columns=['Sentences']) | ||
| return sentences_df | ||
|
|
@@ -90,7 +90,7 @@ def clusteringData(self): | |
| db_host=db_config['db_host'], | ||
| db_name=db_config['db_name']) | ||
| self.cursor = self.store_data.db_connect().cursor() | ||
| query_info = "SELECT sentence FROM english_sentences" | ||
| query_info = "SELECT sentence FROM English_sentences" | ||
| self.cursor.execute(query_info) | ||
| sentences_dataframe = pd.DataFrame(self.cursor.fetchall(), columns=['Sentences']) | ||
| return sentences_dataframe | ||
|
|
@@ -129,7 +129,7 @@ def cluster_sentences(self, language_name: str, save_path: str, sentences: List[ | |
| words = self.udt_pre_model.word_segmentation(sent) | ||
| word_vectors = [] | ||
| # iterator to word | ||
| window_words = get_keyword_window(self.sel_result[0][0], words, 5) | ||
| window_words = get_keyword_window(self.sel_result[0][0], words, 10) | ||
| for word in window_words: | ||
| if word in word2vec_model.wv: | ||
| word_vectors.append(word2vec_model.wv[word]) | ||
|
|
@@ -207,9 +207,9 @@ def _get_examples(self, sentences: List[str], best_labels, n_clusters: int): | |
| 'Though his surviving images are scarce, his importance to the early history of photography in Asia is great.'] | ||
|
|
||
| # first loading udpipe to segement word for each sentence | ||
| udt_english = UdpipeTrain(language_list[1], | ||
| r'C:\Users\haris\Desktop\wordFinder\english-ewt-ud-2.5-191206.udpipe', | ||
| r'C:\Users\haris\Desktop\wordFinder\haris.txt') | ||
| # udt_english = UdpipeTrain(language_list[1], | ||
| # r'C:\Users\haris\Desktop\wordFinder\english-ewt-ud-2.5-191206.udpipe', | ||
| # r'C:\Users\haris\Desktop\wordFinder\haris.txt') | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is commented to are you using this as a safe reference? |
||
|
|
||
| cluster_result = AppService().config_udpipe(language_name).cluster_sentences(language_name, sentences, 2) | ||
| print("two examples sentences: \n") | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ <h3>Well done!</h3> After clustering, you get {{cluster_number}} example | |
| {% for cluster_sentence in cluster_result %} | ||
| <li class="list-group-item d-flex justify-content-between align-items-center"> | ||
| {{cluster_sentence}} | ||
| # Add KWIC Functinality | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think, anyone need to add KWIC functionality code here. |
||
| </li> | ||
| {% endfor %} | ||
| {% endif %} | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.