Abstract the dataset by defining a new data structure with datapack. Intuitively, a DataPack consists of five parts: question, answer, gt_answer, contexts, and gt_contexts. Currently, we leave search_query and gt_search_query as future work.
Examples:
>>> question = [
... ['qid1', 'question 1'],
... ['qid2', 'question 2']
... ]
>>> answer = [
... ['aid1', 'answer 1'],
... ['aid2', 'answer 2']
... ]
>>> question = pd.DataFrame(question)
>>> answer = pd.DataFrame(answer)
>>> dp = DataPack(
... question=question,
... answer=answer,
... gt_answer=gt_answer,
... contexts=contexts,
... gt_contexts=gt_contexts,
... )
>>> len(dp)
2
In this way, we can add many inplace functions to process datapack. Some basic usage are as follows:
>>> import rageval as rl
>>> data_pack = rl.datasets.toy.load_data()
>>> data_pack.apply_on_question(preprocess_func)
>>> data_pack.drop_label(inplace=True)
>>> data_pack.has_label
False
Abstract the dataset by defining a new data structure with datapack. Intuitively, a DataPack consists of five parts:
question,answer,gt_answer,contexts, andgt_contexts. Currently, we leavesearch_queryandgt_search_queryas future work.Examples:
In this way, we can add many inplace functions to process datapack. Some basic usage are as follows: