# Path: nordlys/tagme/config.py
# Y_ERD = DATA_DIR + "/Y-ERD.tsv"
# ERD_QUERY = DATA_DIR + "/Trec_beta.query.txt"
# ERD_ANNOTATION = DATA_DIR + "/Trec_beta.annotation.txt"
# WIKI_ANNOT30 = DATA_DIR + "/wiki-annot30"
# WIKI_ANNOT30_SNIPPET = DATA_DIR + "/wiki-annot30-snippet.txt"
# WIKI_ANNOT30_ANNOTATION = DATA_DIR + "/wiki-annot30-annotation.txt"
# WIKI_DISAMB30 = DATA_DIR + "/wiki-disamb30"
# WIKI_DISAMB30_SNIPPET = DATA_DIR + "/wiki-disamb30-snippet.txt"
# WIKI_DISAMB30_ANNOTATION = DATA_DIR + "/wiki-disamb30-annotation.txt"
# COLLECTION_SURFACEFORMS_WIKI = "surfaceforms_wiki_20100408"
# SF_WIKI = SurfaceForms(collection=COLLECTION_SURFACEFORMS_WIKI)
# INDEX_PATH = "/xxx/20100408-index"
# INDEX_ANNOT_PATH = "/xxx/20100408-index-annot/"


import csv
from nordlys.tagme import config
"""
Reads queries from test collections

@author: Faegheh Hasibi (faegheh.hasibi@idi.ntnu.no)
"""



def read_yerd_queries(y_erd_file=config.Y_ERD):
    """
    Reads queries from Erd query file.

    :return dictionary {query_id : query_content}
    """
    queries = {}
    with open(y_erd_file, 'rb') as y_erd:
        reader = csv.DictReader(y_erd, delimiter="\t", quoting=csv.QUOTE_NONE)

        for line in reader:
            qid = line['qid']
            query = line['query']
            queries[qid] = query.strip()
    print "Number of queries:", len(queries)
    return queries



# Path: nordlys/tagme/config.py
# Y_ERD = DATA_DIR + "/Y-ERD.tsv"
# ERD_QUERY = DATA_DIR + "/Trec_beta.query.txt"
# ERD_ANNOTATION = DATA_DIR + "/Trec_beta.annotation.txt"
# WIKI_ANNOT30 = DATA_DIR + "/wiki-annot30"
# WIKI_ANNOT30_SNIPPET = DATA_DIR + "/wiki-annot30-snippet.txt"
# WIKI_ANNOT30_ANNOTATION = DATA_DIR + "/wiki-annot30-annotation.txt"
# WIKI_DISAMB30 = DATA_DIR + "/wiki-disamb30"
# WIKI_DISAMB30_SNIPPET = DATA_DIR + "/wiki-disamb30-snippet.txt"
# WIKI_DISAMB30_ANNOTATION = DATA_DIR + "/wiki-disamb30-annotation.txt"
# COLLECTION_SURFACEFORMS_WIKI = "surfaceforms_wiki_20100408"
# SF_WIKI = SurfaceForms(collection=COLLECTION_SURFACEFORMS_WIKI)
# INDEX_PATH = "/xxx/20100408-index"
# INDEX_ANNOT_PATH = "/xxx/20100408-index-annot/"


# Path: nordlys/tagme/test_coll.py
import csv
from nordlys.tagme import config

"""
Reads queries from test collections

@author: Faegheh Hasibi (faegheh.hasibi@idi.ntnu.no)
"""



def read_yerd_queries(y_erd_file=config.Y_ERD):
    """
    Reads queries from Erd query file.

    :return dictionary {query_id : query_content}
    """
    queries = {}
    with open(y_erd_file, 'rb') as y_erd:
        reader = csv.DictReader(y_erd, delimiter="\t", quoting=csv.QUOTE_NONE)

        for line in reader:
            qid = line['qid']
            query = line['query']
            queries[qid] = query.strip()
    print "Number of queries:", len(queries)
    return queries



def read_erd_queries(erd_q_file=config.ERD_QUERY):