Ejemplo n.º 1
0
import parser
import Pyscandl
from fetchers import fetcher_enum

if __name__ == "__main__":
	args = parser.parse_arg()
	fetcher = fetcher_enum.Fetcher.get(args.fetcher).value

	pyscandl = Pyscandl.Pyscandl(fetcher, chapstart=args.chapter_start, output=args.output, keepimage=args.keep_images, all=args.all, link=args.link, manga=args.manga, download_number=args.download_number)

	pyscandl.full_download()
Ejemplo n.º 2
0
    "question_weight": 1,
    "concepts_weight": 1,
    "narrative_weight": 1,
    "query_path": "../queries/query-train.xml",
    "cdn": 1,
    "ctc": 1,
    "cte": 1,
    "cts": 1,
    "unigram_weight": 1,
    "bigram_weight": 1,
    "rocchio_iters": 1,
    "use_cosine": False
}

if __name__ == '__main__':
    parser.parse_arg(configs)
    print("Rocchio Mode: ", configs["use_rocchio"])
    fname_to_id, id_to_fname = parser.parse_file_list(configs)
    vocab_to_id, id_to_vocab = parser.parse_vocab_list(configs)
    doc_count = len(fname_to_id)
    inverted_files, gram_to_id, gram_count, id_to_doclen = parser.parse_inverted_file(
        configs, doc_count)
    configs["gram_count"] = gram_count
    configs["doc_count"] = doc_count
    # Save checkpoint for notebook
    avdl = sum(id_to_doclen.values()) / len(id_to_doclen)
    corpus = {
        "fname_to_id": fname_to_id,
        "id_to_doclen": id_to_doclen,
        "id_to_fname": id_to_fname,
        "vocab_to_id": vocab_to_id,
Ejemplo n.º 3
0
from train import TrainNet
from parser import parse_arg, parse_shape


class Predict(TrainNet):
    def valid(self):
        for i in range(self.data.len):
            y, x = self.data.get_for_test(i)
            x = x.reshape(x.shape[0], 1)
            pred = self.forward(x)
            if pred > 0.5:
                p = "B"
            else:
                p = "M"
            print("ID: ", self.data.ID[i], " Predict: ", pred[0, 0],
                  " Class: ", p)


if __name__ == "__main__":

    args = parse_arg()
    if not args.weight:
        print("Give me weights")
        exit(0)
    else:
        shape = parse_shape(args.weight)
        print("Shape: ", shape)
        net = Predict(shape, args.train)
        net.read(args.weight)
        net.valid()