s
This commit is contained in:
commit
30f1a744ba
8
.idea/PJN_JANEK.iml
Normal file
8
.idea/PJN_JANEK.iml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="jdk" jdkName="Python 3.6" jdkType="Python SDK" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
4
.idea/misc.xml
Normal file
4
.idea/misc.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/PJN_JANEK.iml" filepath="$PROJECT_DIR$/.idea/PJN_JANEK.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
160
.idea/workspace.xml
Normal file
160
.idea/workspace.xml
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="05531c49-b8a5-43c9-88bb-6438549397fb" name="Default Changelist" comment="" />
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="FileTemplateManagerImpl">
|
||||||
|
<option name="RECENT_TEMPLATES">
|
||||||
|
<list>
|
||||||
|
<option value="Python Script" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectId" id="1V1056F7pegcONHmxHjW7JX6xXo" />
|
||||||
|
<component name="ProjectViewState">
|
||||||
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
|
<option name="showExcludedFiles" value="true" />
|
||||||
|
<option name="showLibraryContents" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent">
|
||||||
|
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||||
|
<property name="last_opened_file_path" value="$PROJECT_DIR$/ewaluacja.py" />
|
||||||
|
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
|
||||||
|
</component>
|
||||||
|
<component name="RunManager" selected="Python.ewaluacja">
|
||||||
|
<configuration default="true" type="PythonConfigurationType" factoryName="Python">
|
||||||
|
<module name="PJN_JANEK" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="/usr/bin/python3.6" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="false" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/dzielenie.py" />
|
||||||
|
<option name="PARAMETERS" value="" />
|
||||||
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
|
<option name="EMULATE_TERMINAL" value="false" />
|
||||||
|
<option name="MODULE_MODE" value="false" />
|
||||||
|
<option name="REDIRECT_INPUT" value="false" />
|
||||||
|
<option name="INPUT_FILE" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration name="dzielenie" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
||||||
|
<module name="PJN_JANEK" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="/usr/bin/python3.6" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="false" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/dzielenie.py" />
|
||||||
|
<option name="PARAMETERS" value="" />
|
||||||
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
|
<option name="EMULATE_TERMINAL" value="false" />
|
||||||
|
<option name="MODULE_MODE" value="false" />
|
||||||
|
<option name="REDIRECT_INPUT" value="false" />
|
||||||
|
<option name="INPUT_FILE" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration name="ewaluacja" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
||||||
|
<module name="PJN_JANEK" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="/usr/bin/python3.6" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="false" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/ewaluacja.py" />
|
||||||
|
<option name="PARAMETERS" value="" />
|
||||||
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
|
<option name="EMULATE_TERMINAL" value="false" />
|
||||||
|
<option name="MODULE_MODE" value="false" />
|
||||||
|
<option name="REDIRECT_INPUT" value="false" />
|
||||||
|
<option name="INPUT_FILE" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<list>
|
||||||
|
<item itemvalue="Python.dzielenie" />
|
||||||
|
<item itemvalue="Python.ewaluacja" />
|
||||||
|
</list>
|
||||||
|
</component>
|
||||||
|
<component name="ServiceViewManager">
|
||||||
|
<option name="viewStates">
|
||||||
|
<list>
|
||||||
|
<serviceView>
|
||||||
|
<treeState>
|
||||||
|
<expand />
|
||||||
|
<select />
|
||||||
|
</treeState>
|
||||||
|
</serviceView>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="SvnConfiguration">
|
||||||
|
<configuration />
|
||||||
|
</component>
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="05531c49-b8a5-43c9-88bb-6438549397fb" name="Default Changelist" comment="" />
|
||||||
|
<created>1576405107785</created>
|
||||||
|
<option name="number" value="Default" />
|
||||||
|
<option name="presentableId" value="Default" />
|
||||||
|
<updated>1576405107785</updated>
|
||||||
|
</task>
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
<component name="WindowStateProjectService">
|
||||||
|
<state x="660" y="239" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1576408832043">
|
||||||
|
<screen x="67" y="27" width="1974" height="1104" />
|
||||||
|
</state>
|
||||||
|
<state x="660" y="239" key="#com.intellij.execution.impl.EditConfigurationsDialog/67.27.1974.1104@67.27.1974.1104" timestamp="1576408832043" />
|
||||||
|
<state x="901" y="386" width="592" height="390" key="#com.intellij.fileTypes.FileTypeChooser" timestamp="1576407842399">
|
||||||
|
<screen x="67" y="27" width="1974" height="1104" />
|
||||||
|
</state>
|
||||||
|
<state x="901" y="386" width="592" height="390" key="#com.intellij.fileTypes.FileTypeChooser/67.27.1974.1104@67.27.1974.1104" timestamp="1576407842399" />
|
||||||
|
<state x="935" y="330" width="524" height="502" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog" timestamp="1576407146349">
|
||||||
|
<screen x="67" y="27" width="1974" height="1104" />
|
||||||
|
</state>
|
||||||
|
<state x="935" y="330" width="524" height="502" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/67.27.1974.1104@67.27.1974.1104" timestamp="1576407146349" />
|
||||||
|
<state x="985" y="339" width="424" height="484" key="FileChooserDialogImpl" timestamp="1576408829810">
|
||||||
|
<screen x="67" y="27" width="1974" height="1104" />
|
||||||
|
</state>
|
||||||
|
<state x="985" y="339" width="424" height="484" key="FileChooserDialogImpl/67.27.1974.1104@67.27.1974.1104" timestamp="1576408829810" />
|
||||||
|
<state width="1377" height="254" key="GridCell.Tab.0.bottom" timestamp="1576410051870">
|
||||||
|
<screen x="67" y="27" width="1974" height="1104" />
|
||||||
|
</state>
|
||||||
|
<state width="1377" height="254" key="GridCell.Tab.0.bottom/67.27.1974.1104@67.27.1974.1104" timestamp="1576410051870" />
|
||||||
|
<state width="1377" height="254" key="GridCell.Tab.0.center" timestamp="1576410051869">
|
||||||
|
<screen x="67" y="27" width="1974" height="1104" />
|
||||||
|
</state>
|
||||||
|
<state width="1377" height="254" key="GridCell.Tab.0.center/67.27.1974.1104@67.27.1974.1104" timestamp="1576410051869" />
|
||||||
|
<state width="1377" height="254" key="GridCell.Tab.0.left" timestamp="1576410051868">
|
||||||
|
<screen x="67" y="27" width="1974" height="1104" />
|
||||||
|
</state>
|
||||||
|
<state width="1377" height="254" key="GridCell.Tab.0.left/67.27.1974.1104@67.27.1974.1104" timestamp="1576410051868" />
|
||||||
|
<state width="1377" height="254" key="GridCell.Tab.0.right" timestamp="1576410051869">
|
||||||
|
<screen x="67" y="27" width="1974" height="1104" />
|
||||||
|
</state>
|
||||||
|
<state width="1377" height="254" key="GridCell.Tab.0.right/67.27.1974.1104@67.27.1974.1104" timestamp="1576410051869" />
|
||||||
|
<state x="691" y="216" key="SettingsEditor" timestamp="1576406312643">
|
||||||
|
<screen x="67" y="27" width="1974" height="1104" />
|
||||||
|
</state>
|
||||||
|
<state x="691" y="216" key="SettingsEditor/67.27.1974.1104@67.27.1974.1104" timestamp="1576406312643" />
|
||||||
|
</component>
|
||||||
|
</project>
|
1353
development
Normal file
1353
development
Normal file
File diff suppressed because one or more lines are too long
54
dzielenie.py
Normal file
54
dzielenie.py
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import os
|
||||||
|
import nltk
|
||||||
|
import re
|
||||||
|
|
||||||
|
number_lines = os.popen("wc -l < reviews").read()
|
||||||
|
|
||||||
|
|
||||||
|
pierwszy = 0.8 * float(number_lines)
|
||||||
|
|
||||||
|
drugi = 0.9 * float(number_lines)
|
||||||
|
|
||||||
|
dane = open("reviews", "r")
|
||||||
|
|
||||||
|
linia =1
|
||||||
|
|
||||||
|
learning_s = open("learning", "a")
|
||||||
|
|
||||||
|
development_s = open("development", "a")
|
||||||
|
|
||||||
|
testing_s = open("testing", "a")
|
||||||
|
|
||||||
|
|
||||||
|
def magic(text):
|
||||||
|
tokeny = nltk.word_tokenize(text)
|
||||||
|
slownik = {}
|
||||||
|
string = "|"
|
||||||
|
for n in tokeny:
|
||||||
|
if n in slownik:
|
||||||
|
slownik[n] =+1
|
||||||
|
else:
|
||||||
|
slownik[n] = 1
|
||||||
|
for n in slownik:
|
||||||
|
string += " "+n+":."+str(slownik[n])
|
||||||
|
return string
|
||||||
|
|
||||||
|
|
||||||
|
for n in dane:
|
||||||
|
reg = re.search(r"^([0-9]+)( *|-*)([^0-9].*)", n.replace(":", " ").replace(".", " ").replace("|", " ").replace("\n", " ").lower())
|
||||||
|
if reg is not None:
|
||||||
|
|
||||||
|
if linia <= pierwszy:
|
||||||
|
learning_s.write(reg.group(1)+magic(reg.group(3))+'\n')
|
||||||
|
elif linia <= drugi:
|
||||||
|
development_s.write(reg.group(1)+magic(reg.group(3))+'\n')
|
||||||
|
else:
|
||||||
|
testing_s.write(reg.group(1)+magic(reg.group(3))+'\n')
|
||||||
|
linia +=1
|
||||||
|
|
||||||
|
learning_s.close()
|
||||||
|
dane.close()
|
||||||
|
development_s.close()
|
||||||
|
testing_s.close()
|
||||||
|
|
||||||
|
os.popen("vw learning -f model_ai")
|
30
ewaluacja.py
Normal file
30
ewaluacja.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import re
|
||||||
|
import os
|
||||||
|
import math
|
||||||
|
|
||||||
|
prawdziwe = []
|
||||||
|
przewidziane = []
|
||||||
|
|
||||||
|
|
||||||
|
def wrozka(line):
|
||||||
|
f = open("test","w")
|
||||||
|
f.write(line)
|
||||||
|
f.close()
|
||||||
|
return float(os.popen("vw -i model_ai test -p /dev/stdout --quiet").read())
|
||||||
|
|
||||||
|
|
||||||
|
def ocena(praw,prze):
|
||||||
|
bledy = 0.0
|
||||||
|
for n in range(len(praw)):
|
||||||
|
bledy += math.fabs(praw[n]-prze[n])
|
||||||
|
return bledy/float(len(praw))
|
||||||
|
|
||||||
|
|
||||||
|
file = open("development", "r")
|
||||||
|
for n in file:
|
||||||
|
reg = re.search(r"^([0-9]+)( *|-*)([^0-9].*)", n)
|
||||||
|
prawdziwe.append(float(reg.group(1)))
|
||||||
|
przewidziane.append(wrozka(reg.group(3)))
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
print(ocena(prawdziwe, przewidziane))
|
1
test
Normal file
1
test
Normal file
@ -0,0 +1 @@
|
|||||||
|
| ``:.1 w:.1 jego:.1 oczach:.1 '':.1 to:.1 kontynuacja:.1 losów:.1 bohaterów:.1 poznanych:.1 książce:.1 oczy:.1 wilka:.1 więc:.1 jeśli:.1 nie:.1 znacie:.1 pierwszej:.1 części:.1 ,:.1 zdecydowanie:.1 warto:.1 ją:.1 nadrobić:.1 lena:.1 i:.1 artur:.1 zaręczyli:.1 się:.1 po:.1 dwóch:.1 latach:.1 związku:.1 jednak:.1 nadal:.1 brakuje:.1 nim:.1 zaufania:.1 mówi:.1 lenie:.1 wszystkiego:.1 jest:.1 tajemniczy:.1 ma:.1 go:.1 całe:.1 dnie:.1 domu:.1 czuje:.1 osamotniona:.1 odsunięta:.1 a:.1 dodatku:.1 dzieją:.1 dziwne:.1 rzeczy:.1 które:.1 widzi:.1 tylko:.1 ona:.1 zaczyna:.1 podejrzewać:.1 u:.1 siebie:.1 chorobę:.1 psychiczną:.1 ale:.1 swoim:.1 narzeczonym:.1 znajduje:.1 oparcia:.1 posiadłości:.1 mangano:.1 pojawia:.1 również:.1 nowa:.1 osoba:.1 która:.1 sieje:.1 zamęt:.1 sercu:.1 umyśle:.1 dziewczyny:.1 czy:.1 ich:.1 związek:.1 stanie:.1 przetrwać:.1 ten:.1 ciężki:.1 czas:.1 ?:.1 jestem:.1 pod:.1 wrażeniem:.1 jaki:.1 sposób:.1 autorka:.1 podeszła:.1 do:.1 kontynuacji:.1 szczerze:.1 mówiąc:.1 przeczytaniu:.1 balam:.1 troszkę:.1 że:.1 będzie:.1 taka:.1 naciągana:.1 nudna:.1 straci:.1 moich:.1 co:.1 zyskała:.1 tak:.1 bardzo:.1 myliłam:.1 !:.1 czytając:.1 tę:.1 historię:.1 widzimy:.1 ogromny:.1 postęp:.1 piórze:.1 autorki:.1 styl:.1 dużo:.1 dojrzały:.1 ciekawszy:.1 z:.1 romansu:.1 zrobił:.1 intrygujący:.1 thriller:.1 między:.1 naszymi:.1 bohaterami:.1 dochodzi:.1 licznych:.1 nieporozumień:.1 niedomówień:.1 sprzeczek:.1 uczucie:.1 wystawione:.1 na:.1 próbę:.1 cały:.1 coś:.1 dzieje:.1 my:.1 zostajemy:.1 wciągnięci:.1 poszukiwanie:.1 prawdy:.1 tej:.1 mnie:.1 denerwował:.1 magnetyzujacego:.1 mężczyzny:.1 odpychającym:.1 chamem:.1 prostakiem:.1 liczył:.1 uczuciami:.1 jej:.1 starania:.1 o:.1 uwagę:.1 pomoc:.1 olewał:.1 dopiero:.1 gdy:.1 pewne:.1 wydarzenia:.1 otworzyły:.1 mu:.1 wstąpiło:.1 niego:.1 trochę:.1 pokory:.1 zrozumiał:.1 swoje:.1 zachowanie:.1 mam:.1 nadzieję:.1 trzeciej:.1 zrehabilituje:.1 za:.1 stała:.1 dojrzalsza:.1 pełna:.1 cierpliwości:.1 opanowania:.1 podczas:.1 rozdarta:.1 przez:.1 wszystkie:.1 nakładające:.1 problemy:.1 podchodzi:.1 rozsądny:.1 ta:.1 część:.1 podobała:.1 mi:.1 chyba:.1 nawet:.1 ciut:.1 bardziej:.1 może:.1 dreszczyk:.1 emocji:.1 napięcia:.1 towarzyszyły:.1 czytania:.1 sprawne:.1 wprowadzenie:.1 nowych:.1 te:.1 wstawki:.1 tytułem:.1 mega:.1 liczne:.1 zwroty:.1 akcji:.1 mają:.1 tu:.1 miejsce:.1 no:.1 czytelnik:.1 nudzić:.1
|
Loading…
Reference in New Issue
Block a user