Module Defprog


module Defprog: sig .. end
Data structure for definitions with progress.

This source is released to the public domain since 2001. No warranty. Citation of the project Structio and the following URL is appreciated. http://structio.sourceforge.net/repasa



type infoword = {
   mutable word : string;
   mutable heur : Lrepasa.heuresp;
   mutable weight : int;
   mutable seqs : (string * string * (string * string * string)) list;
   mutable cls : (string * string * (string * string * string)) list;
   mutable format : string;
   mutable meaning : string;
   mutable badchoices : string list;
   mutable hints : string list;
   mutable histprog : (string * int * int) list;
}
Information of a word
type defprog = (string * string * string, infoword) Hashtbl.t 
Hashing tables with words and information of each word. Key is (file,word,idmeaning)
val print_defprog : defprog -> unit
Pretty printer of defprog, just for debugging.
module IdSet: Set.Make(sig
type t = string * string * string 
val compare : 'a * 'b * 'c -> 'a * 'b * 'c -> int
end)
Set of identifies.
val srefclassif_from_seq : 'a ->
IdSet.t Pervasives.ref ->
(string * string * string, (string * 'b * ('a * string * string)) list)
Hashtbl.t ->
'b ->
(< attribute : string -> Markup_types.att_value; data : string;
node_type : Markup_document.node_type; sub_nodes : 'c; .. >
list as 'c) ->
unit
srefclassif_from_seq fname rsc hc forsec s adds the classification referenced in sequence s (in file with name fname) to the set rsc, and associates to the identification of the classification the sequence where it appears along with the format forsec in hc.
fname : Name of file with sequence.
rsc : Set where identification of classifications will be added.
hc : Hashing table where sequences where each classification is referenced.
forsec : Format for sequence
s : Sequence
val srefword_from_classif : string ->
string ->
int Pervasives.ref ->
(string * string * (string * string * string)) list ->
IdSet.t Pervasives.ref ->
(string * string * string, infoword) Hashtbl.t ->
(string, 'a) Hashtbl.t * string list Pervasives.ref ->
string ->
(< attribute : string -> Markup_types.att_value; data : string;
node_type : Markup_document.node_type; pos_file : 'a; sub_nodes : 'b; .. >
list as 'b) ->
unit
Extract words referenced in a classification.
defname : Name of default file with definitions
narch : Name of file with classification
maxwe : Maximal weight of a word.
lns : List of sequences where the classification is referenced.
rsw : Set of identifiers.
hw : Structure defprog.
(hsw,lsw) : lsw : List of words in hsw
hsw : Hashing table with just words
forcla : Format of descriptions in classifications.
c : Classification.
val srefword_from_sclassif : string ->
int Pervasives.ref ->
string ->
string ->
('a Markup_document.extension Markup_document.node as 'a) list ->
IdSet.t Pervasives.ref ->
(string * string * string, infoword) Hashtbl.t ->
(string, string) Hashtbl.t * string list Pervasives.ref ->
(string * string * string,
(string * string * (string * string * string)) list)
Hashtbl.t -> IdSet.t -> unit
val update_meaning : string ->
string ->
('a Markup_document.extension Markup_document.node as 'a) list ->
(string * string * string, infoword) Hashtbl.t ->
IdSet.t -> unit
update_meaning fname fordef fdef hw sw updates meaning of the words appearing in sw with information of file with definitions fdef (name fname).
fname : Name of last opened file with definitions.
fordef : Format of file fname.
fdef : Definitions in fname.
hw : Structure defprog.
sw : Set with identifications of words to update.
val insert_all_meanings : 'a ->
string ->
(string, string) Hashtbl.t ->
string list Pervasives.ref ->
('a * string * string, infoword) Hashtbl.t ->
int Pervasives.ref ->
< attribute : string -> Markup_types.att_value;
node_type : Markup_document.node_type;
sub_nodes : < attribute : string -> Markup_types.att_value;
node_type : Markup_document.node_type; pos_file : string;
sub_nodes : < data : string;
node_type : Markup_document.node_type; .. >
list;
.. >
list;
.. >
list -> unit
insert_all_meanings fname fordef hw f inserts all the words (along with meanings, hints and bad choices) of definition tree f (file fname, format fordef) in hw, always with weight 0

Updates a prdef structure with information of a progress file.
val update_prdef : (string * string * string, infoword) Hashtbl.t ->
< attribute : string -> Markup_types.att_value;
node_type : Markup_document.node_type;
sub_nodes : < attribute : string -> Markup_types.att_value;
node_type : Markup_document.node_type; .. >
list;
.. > ->
unit
module WSet: Set.Make(sig
type t = string * string * string * float 
val compare : 'a * 'b * 'c * 'd -> 'a * 'b * 'c * 'd -> int
end)
Set for words, each element has file, identification (word), meaning and weight.
val ord_words : (infoword -> 'a -> float) ->
'a ->
(string * string * string, infoword) Hashtbl.t ->
string list Pervasives.ref -> WSet.elt list
Returns a list with the identifications and weights of words ordered in increasing order. To measure the weight uses the function fpol.
fpol : Politic to measure new weight of a word
maxw : Maximal weight of a word
hw : defprog structure.
val read_sec : ('a #Markup_document.extension Markup_document.node as 'a) list ->
string ->
string ->
string Pervasives.ref ->
string Pervasives.ref ->
(string * string * string, infoword) Hashtbl.t ->
(string, string) Hashtbl.t ->
string list Pervasives.ref -> int Pervasives.ref -> unit
read_sec ss ... Reads words referenced in classification referenced in the sequences in ss
val read_cla : (string * string * string, infoword) Hashtbl.t ->
(string, string) Hashtbl.t ->
string list Pervasives.ref -> int Pervasives.ref -> string * string -> unit
read_cla ss ... Reads words referenced in classifications of cla.
val read_def : (string * string * string, infoword) Hashtbl.t ->
(string, string) Hashtbl.t ->
string list Pervasives.ref -> int Pervasives.ref -> string -> unit
read_def ss ... Reads words fo a definitions file
val read : ('a #Markup_document.extension Markup_document.node as 'a) list * string *
string * string Pervasives.ref * string Pervasives.ref ->
(string * string) list ->
string list ->
(infoword -> int -> float) ->
bool ->
int ->
< root : < sub_nodes : < attribute : string -> Markup_types.att_value;
node_type : Markup_document.node_type;
sub_nodes : < attribute : string ->
Markup_types.att_value;
node_type : Markup_document.node_type;
.. >
list;
.. >
list;
.. >;
.. > ->
(string * string * string * float * infoword) list * int *
string list
class default_ext : object .. end
Default extension to node of Markup tree.
val default_extension : default_ext
val update_prog : ('a Markup_document.node Markup_document.extension as 'a)
Markup_document.node ->
string * string * string -> infoword -> int -> int -> unit
Updates markup tree with progress whit information for one word, procesed today.
progtree : Tree of progress to update.
(fw,idw,idm) : idm : Identificación del significado.
idw : Palabra.
fw : Archivo donde está la palabra.
iw : Estructura defprog.
nasked : Amount of times the word was asked today.
ngood : Amount of correct answers.
val mailprog : string Pervasives.ref
program to send email
val lper : (string * string * string * float * infoword) list Pervasives.ref
List of words to ask
val totq : int Pervasives.ref
Amount of words available
val lcla : (string * string) list Pervasives.ref
Classifications to open
val ldef : string list Pervasives.ref
Definitions files to open
val maxtime : int Pervasives.ref
Max amount of seconds for test, if it is 0 there is no limit
val wtime : bool Pervasives.ref
Indicates if time should be used
val start_time : int Pervasives.ref
Time measured at beginning of test
val lpal : string list Pervasives.ref
List of words to complete multiple choice tests
val lseq : ('a Markup_document.extension Markup_document.node as 'a) list Pervasives.ref
List with sequences that could be selected
val remail : string Pervasives.ref
Email where suggestions must be send.
val format : string Pervasives.ref
Format of information in sequence file

type formQuestion =
| FormqOpen
| FormqChoice
| FormqAhorcado
| FormqRandom
Possible forms of questions supporte by this program, se function formQuestion also
val pformQuestion : formQuestion Pervasives.ref
Form of question selected in command line
val repeatQuestion : bool Pervasives.ref
Indicates if a question must be repeated
val amquestions : int Pervasives.ref
Amount of questions to ask.
val allquestions : bool Pervasives.ref
True iff all the available definitions must be asked.
val numChoices : int Pervasives.ref
Amount of choices in multiple choice questions
val good : int Pervasives.ref
Amount of correct answers
val prdname : string Pervasives.ref
Name of file with progress
val progtree : ('a Markup_document.node Markup_document.extension as 'a)
Markup_document.document Pervasives.ref
Progress data structure
val calcFormQuestion : formQuestion -> formQuestion
Returns a form of question according to f (only useful when f is FormqRandom)
val complete_choices : (string -> bool -> unit) -> int -> 'a list -> 'a list -> 'a list
complete_choices errfun n lop lpal Completes n choices including lop and words choosen aleatory from lpal. In case of error shows error message with errfun.
lpal : List of words, there are enough words to complete lop (e.g. when lpal has no repeated words and n or more)

type tintseq =
| Tintseq of string * string * string * tintseq list
Type tintseq to present a sequence in an interface. Type, id, description and sons
val tintseq_of_seq : string ->
(< attribute : string -> Markup_types.att_value; data : string;
node_type : Markup_document.node_type; sub_nodes : 'a; .. >
list as 'a) ->
tintseq list
tintseq_of_seq s Converts the sequence s to a tintseq, that can be used from an interface
val typid_of_tintseq : tintseq -> string * string
Takes type and id from Tintseq
val seq_of_tids : ('a Markup_document.extension Markup_document.node as 'a) list ->
(string * string) list -> 'a list
seq_of_tids ls li Locates in the list of sequences ls, the types and identification of li. li is a list of pairs (type,id).

type repasa_interface = {
   mutable n : int;
   mutable asked : int;
   mutable remtime : int; (*Indicates if remaining time should be shown or not*)
   mutable shremtime : bool;
   mutable totqsession : int;
   mutable suggestions : string;
   mutable choiceQuestion : repasa_interface -> string -> string -> string list -> unit;
   mutable endSession : repasa_interface -> bool -> int -> int -> unit;
   mutable openQuestion : repasa_interface -> string -> string -> int -> unit;
   mutable ahorcadoQuestion : repasa_interface ->
string -> string -> int -> string -> string -> int -> unit
;
   mutable showAnswer : repasa_interface -> string -> string -> string -> string -> unit;
   mutable showErrorMsg : string -> bool -> unit;
   mutable shcls : bool;
   mutable intcls : string;
   mutable shprog : bool;
   mutable intprog : string;
   mutable shpol : bool; (*Value of politics*)
   mutable intpol : float;
   mutable shseqs : bool; (*Sequence where question is repasad*)
   mutable intseqs : string;
   mutable shhints : bool; (*Hint to show*)
   mutable hint : string;
   mutable shweight : bool; (*Weight of definition*)
   mutable intweight : int;
}
val last_fw : string Pervasives.ref
file of last asked word
val last_word : string Pervasives.ref
id of last asked word
val last_idm : string Pervasives.ref
idm of last asked word
val last_form : formQuestion Pervasives.ref
Last form of question
val last_ltop : string list Pervasives.ref
Last list of options in multiple choice question
val last_iw : infoword Pervasives.ref
val endRepasa : bool -> repasa_interface -> unit
endRepasa interf writes progress, sends email and returns results
val nextQuestion : repasa_interface -> bool -> unit
nextQuestions interf newq asks a question from the list of questions. If newq is false repeat last question.
interf : Interface to use
newq : If false last question is asked again. If there are not more questions to ask, call end functions.
val receiveAnswer : repasa_interface -> string -> unit
receiveAnswer interf Receives an answer ans from interface interf, and updates progress according to it.
interf : Interface to use.
ans : Answer in the same format of the question.
val fname : string Pervasives.ref
val defname : string Pervasives.ref
val fpol_pgm : Prom.stmt list -> infoword -> int -> float
fpol_pgm pgm iw maxw returns a politics value computed by prom program pgm, based on information of the word iw and knowing that the maxium of all weights is maxw.
pgm_prom : Program in prom to compute politics, it receives the variables: peso: integer. Weight of word according to .cla maxpeso: Maximum weight of all words. hoy Date of today (conted in days from 1/Jan/1970 and converted to float) ejecutor: String repasa dia: Array of float with dates when the word was answered. It is ordered, the oldest dates first. preguntada: Array of float with amount of times the question was asked. It is aligned with dia. bien: Array of float with amount of correct answers. It is aligned with dia. it must return a floating number with the politic value for the word (greather value means more important).
iw : Information of word
maxw : Maximum weight
val fpol_random : 'a -> 'b -> float
Possible politic. Random
val fpol_e : 'a -> 'b -> float
Possible politic. Equal priority to all the words
val fpol_w : infoword -> 'a -> float
Possible politic. Just the weight assigned by editor of words.
val fpol_p : infoword -> int -> float
Possible politic. Aleatory trying to favor words with high weight but not very studied or with wrong answers.
val fpol : (infoword -> int -> float) Pervasives.ref
val add_arch_ref : bool ->
string ->
string ->
(< attribute : string -> Markup_types.att_value;
attributes : (string * Markup_types.att_value) list;
node_type : Markup_document.node_type;
quick_set_attributes : (string * Markup_types.att_value) list -> unit;
sub_nodes : 'a; .. >
list as 'a) ->
unit
add_arch_ref claname lseq In the forest lseq adds to the nodes refclasif withouth "arch" attribute, such attribute with value claname
val prep_to_open : repasa_interface -> string Pervasives.ref -> string -> unit
prep_to_open interf format fname Prepares the file fname for opening it. If it is a sequence adds to lseq its nodes and fills format, if it is a classficiation fills lcla; and if it is a definitions file adds it to ldef
val parse_time : string -> int
parse_time s parses a string that should have time followed by a unit, it should be a number followed by any of the postfix s for seconds, m for minutes, h for hours. If no affix follows seconds is assumed.
Returns Amount of seconds
val def_val_interface : repasa_interface -> unit
def_val_interface interf Assigns default values to data of interface interf.
val parse_args : Cmd.infoprg ->
repasa_interface -> bool * tintseq list * string * string
parse_args info interfParses arguments and intialize variables and interface.
val prepareQuestions : repasa_interface -> (string * string) list -> unit
prepareQuestions interf lis prepares the questions of the files parsed in command line and of the sequences referenced in lis
val ahorcadoArmar : string -> string -> string
ahorcadoArmar response usedchars retorna la cadena response con * los carácteres que no están en usedchars remplazados por espacios. *
Author(s): Ugo Enrico Albarello