Syllabled basic bidirectional ready for test

This commit is contained in:
lkrsnik 2018-03-27 15:05:48 +02:00
parent 040969fb09
commit 54abaf052a
2 changed files with 88 additions and 77 deletions

View File

@ -2,7 +2,10 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="8a8ba9af-e1a4-433a-9968-475192610776" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/v5_0/workbench.py" afterPath="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/v5_0/workbench.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/cnn/word_accetuation/syllables/cnn.ipynb" afterPath="$PROJECT_DIR$/cnn/word_accetuation/syllables/cnn.ipynb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/prepare_data.py" afterPath="$PROJECT_DIR$/prepare_data.py" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
@ -32,22 +35,41 @@
<file leaf-file-name="prepare_data.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/prepare_data.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252">
<caret line="53" column="112" lean-forward="false" selection-start-line="53" selection-start-column="98" selection-end-line="53" selection-end-column="112" />
<state relative-caret-position="298">
<caret line="338" column="107" lean-forward="false" selection-start-line="338" selection-start-column="107" selection-end-line="338" selection-end-column="107" />
<folding>
<element signature="e#24#63#0" expanded="true" />
<element signature="e#6821#8109#0" expanded="false" />
<element signature="e#9765#10060#0" expanded="false" />
<element signature="e#13592#14199#0" expanded="false" />
<element signature="e#16771#17073#0" expanded="false" />
<element signature="e#18046#18392#0" expanded="false" />
<element signature="e#22808#23455#0" expanded="false" />
<element signature="e#34768#34909#0" expanded="false" />
<element signature="e#17366#17668#0" expanded="false" />
<element signature="e#18641#18987#0" expanded="false" />
<element signature="e#23403#24050#0" expanded="false" />
<element signature="e#35363#35504#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="workbench.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/cnn/word_accetuation/syllables/v3_0/workbench.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="594">
<caret line="44" column="18" lean-forward="true" selection-start-line="44" selection-start-column="18" selection-end-line="44" selection-end-column="18" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="workbench.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/cnn/word_accetuation/syllables/v2_4/workbench.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="414">
<caret line="34" column="11" lean-forward="false" selection-start-line="34" selection-start-column="11" selection-end-line="34" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="sloleks_accentuation.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/sloleks_accentuation.py">
<provider selected="true" editor-type-id="text-editor">
@ -92,11 +114,11 @@
</provider>
</entry>
</file>
<file leaf-file-name="workbench.py" pinned="false" current-in-tab="true">
<file leaf-file-name="workbench.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/v5_0/workbench.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="676">
<caret line="80" column="65" lean-forward="true" selection-start-line="80" selection-start-column="65" selection-end-line="80" selection-end-column="65" />
<state relative-caret-position="190">
<caret line="32" column="67" lean-forward="false" selection-start-line="32" selection-start-column="20" selection-end-line="32" selection-end-column="67" />
<folding />
</state>
</provider>
@ -181,10 +203,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>generate_x_and</find>
<find>accentuate</find>
<find>_generator</find>
<find>_create_syllable_letters_translator</find>
<find>_accent_classification</find>
<find>wrong</find>
<find>wrong_word</find>
@ -211,6 +229,10 @@
<find>_generate_x_and_y</find>
<find>content</find>
<find>number_of_syllables</find>
<find>_create_syllables</find>
<find>reverse_inputs</find>
<find>index</find>
<find>x_sy</find>
</findStrings>
</component>
<component name="Git.Settings">
@ -232,9 +254,10 @@
<option value="$PROJECT_DIR$/notes" />
<option value="$PROJECT_DIR$/workbench.xrsl" />
<option value="$PROJECT_DIR$/sloleks_accentuation.py" />
<option value="$PROJECT_DIR$/prepare_data.py" />
<option value="$PROJECT_DIR$/workbench.py" />
<option value="$PROJECT_DIR$/prepare_data.py" />
<option value="$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/v5_0/workbench.py" />
<option value="$PROJECT_DIR$/cnn/word_accetuation/syllables/v3_0/workbench.py" />
</list>
</option>
</component>
@ -321,7 +344,7 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="cnn_dictionary" />
<option name="myItemId" value="syllables" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@ -343,11 +366,11 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="cnn_dictionary" />
<option name="myItemId" value="syllables" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="v5_0" />
<option name="myItemId" value="v2_4" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@ -638,25 +661,6 @@
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39979124" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
</layout>
<layout-to-restore>
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32985386" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32985386" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32985386" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.12227074" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39979124" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
</layout-to-restore>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
@ -667,31 +671,11 @@
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<option name="time" value="6" />
<option name="time" value="7" />
</breakpoint-manager>
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/theano_tutorial/logistic_regression.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="846">
<caret line="49" column="31" lean-forward="false" selection-start-line="49" selection-start-column="31" selection-end-line="49" selection-end-column="31" />
<folding>
<element signature="e#0#12#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/theano_tutorial/tutorial_derivates.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/theanoTest.py" />
<entry file="file://$PROJECT_DIR$/theano_tutorial/test.py">
<provider selected="true" editor-type-id="text-editor">
@ -1018,25 +1002,40 @@
</entry>
<entry file="file://$PROJECT_DIR$/prepare_data.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252">
<caret line="53" column="112" lean-forward="false" selection-start-line="53" selection-start-column="98" selection-end-line="53" selection-end-column="112" />
<state relative-caret-position="298">
<caret line="338" column="107" lean-forward="false" selection-start-line="338" selection-start-column="107" selection-end-line="338" selection-end-column="107" />
<folding>
<element signature="e#24#63#0" expanded="true" />
<element signature="e#6821#8109#0" expanded="false" />
<element signature="e#9765#10060#0" expanded="false" />
<element signature="e#13592#14199#0" expanded="false" />
<element signature="e#16771#17073#0" expanded="false" />
<element signature="e#18046#18392#0" expanded="false" />
<element signature="e#22808#23455#0" expanded="false" />
<element signature="e#34768#34909#0" expanded="false" />
<element signature="e#17366#17668#0" expanded="false" />
<element signature="e#18641#18987#0" expanded="false" />
<element signature="e#23403#24050#0" expanded="false" />
<element signature="e#35363#35504#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/cnn/word_accetuation/syllables/v2_4/workbench.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="414">
<caret line="34" column="11" lean-forward="false" selection-start-line="34" selection-start-column="11" selection-end-line="34" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/cnn/word_accetuation/cnn_dictionary/v5_0/workbench.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="676">
<caret line="80" column="65" lean-forward="true" selection-start-line="80" selection-start-column="65" selection-end-line="80" selection-end-column="65" />
<state relative-caret-position="190">
<caret line="32" column="67" lean-forward="false" selection-start-line="32" selection-start-column="20" selection-end-line="32" selection-end-column="67" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/cnn/word_accetuation/syllables/v3_0/workbench.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="594">
<caret line="44" column="18" lean-forward="true" selection-start-line="44" selection-start-column="18" selection-end-line="44" selection-end-column="18" />
<folding />
</state>
</provider>

View File

@ -261,25 +261,37 @@ class Data:
#i += 1
return x
def _x_syllable_input(self, content, dictionary, max_num_vowels, vowels):
x = np.zeros((len(content), max_num_vowels), dtype=int)
def _x_syllable_input(self, content, dictionary, max_num_vowels, vowels, shuffle_vector_location):
if not self._bidirectional_basic_input:
x = np.zeros((len(content), max_num_vowels), dtype=int)
else:
x = np.zeros((len(content), 2 * max_num_vowels), dtype=int)
i = 0
for el in content:
if self._shuffle_all_inputs:
s = self._load_shuffle_vector(shuffle_vector_location, len(content))
else:
s = None
for i in range(len(content)):
if self._shuffle_all_inputs:
mod_i = s[i]
else:
mod_i = i
j = 0
syllables = self._create_syllables(el[0], vowels)
syllables = self._create_syllables(content[mod_i][0], vowels)
if self._reverse_inputs:
syllables = syllables[::-1]
for syllable in syllables:
if j >= max_num_vowels:
continue
if syllable in dictionary:
index = dictionary.index(syllable)
x[i][j] = dictionary.index(syllable)
if self._bidirectional_basic_input:
x[i][max_num_vowels + (len(syllables) - j - 1)] = dictionary.index(syllable)
else:
index = 0
x[i][j] = index
x[i][j] = 0
j += 1
i += 1
#i += 1
return x
def _y_output(self, content, max_num_vowels, vowels, accentuated_vowels, shuffle_vector_location):
@ -324,7 +336,7 @@ class Data:
if self._input_type == 'l':
x = self._x_letter_input(content, dictionary, max_word, vowels, shuffle_vector_location)
elif self._input_type == 's' or self._input_type == 'sl':
x = self._x_syllable_input(content, dictionary, max_num_vowels, vowels)
x = self._x_syllable_input(content, dictionary, max_num_vowels, vowels, shuffle_vector_location)
else:
raise ValueError('No input_type provided. It could be \'l\', \'s\' or \'sl\'.')
y = self._y_output(content, max_num_vowels, vowels, accentuated_vowels, shuffle_vector_location)