Skip to content

Commit 1bb3995

Browse files
committed
add more examples
1 parent 9aa5cee commit 1bb3995

File tree

5 files changed

+418
-473
lines changed

5 files changed

+418
-473
lines changed

docs/src/index.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,94 @@ println("Acc for train: $acc_train")
193193
println("Acc for val: $acc_val")
194194
```
195195

196+
After you had results from path finding functions like learn_paths or build_paths, you can later save the results into a csv file or into a dataframe which can be loaded into R.
197+
Examples are like these:
198+
199+
```julia
200+
JudiLing.write2csv(
201+
res_train,
202+
latin_train,
203+
cue_obj_train,
204+
cue_obj_train,
205+
"latin_train_res.csv",
206+
grams=3,
207+
tokenized=false,
208+
sep_token=nothing,
209+
start_end_token="#",
210+
output_sep_token="",
211+
path_sep_token=":",
212+
target_col=:Word,
213+
root_dir=@__DIR__,
214+
output_dir="latin_out"
215+
)
216+
217+
JudiLing.write2csv(
218+
res_val,
219+
latin_val,
220+
cue_obj_train,
221+
cue_obj_val,
222+
"latin_val_res.csv",
223+
grams=3,
224+
tokenized=false,
225+
sep_token=nothing,
226+
start_end_token="#",
227+
output_sep_token="",
228+
path_sep_token=":",
229+
target_col=:Word,
230+
root_dir=@__DIR__,
231+
output_dir="latin_out"
232+
)
233+
234+
JudiLing.write2csv(
235+
gpi_train,
236+
"latin_train_gpi.csv",
237+
root_dir=@__DIR__,
238+
output_dir="latin_out"
239+
)
240+
241+
JudiLing.write2csv(
242+
gpi_val,
243+
"latin_val_gpi.csv",
244+
root_dir=@__DIR__,
245+
output_dir="latin_out"
246+
)
247+
248+
df_train = JudiLing.write2df(
249+
res_train,
250+
latin_train,
251+
cue_obj_train,
252+
cue_obj_train,
253+
"latin_train_res.csv",
254+
grams=3,
255+
tokenized=false,
256+
sep_token=nothing,
257+
start_end_token="#",
258+
output_sep_token="",
259+
path_sep_token=":",
260+
target_col=:Word
261+
)
262+
263+
df_val = JudiLing.write2df(
264+
res_val,
265+
latin_val,
266+
cue_obj_train,
267+
cue_obj_val,
268+
"latin_val_res.csv",
269+
grams=3,
270+
tokenized=false,
271+
sep_token=nothing,
272+
start_end_token="#",
273+
output_sep_token="",
274+
path_sep_token=":",
275+
target_col=:Word
276+
)
277+
278+
display(df_train)
279+
display(df_val)
280+
281+
# you may want to delete the temp out folder
282+
path = joinpath(@__DIR__, "latin_out")
283+
rm(path, force=true, recursive=true)
284+
```
285+
196286
You can download and try our completed [script](https://github.com/MegamindHenry/JudiLing.jl/blob/master/examples/latin.jl).

0 commit comments

Comments
 (0)