-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
8 changed files
with
70 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class DataService(object): | ||
|
||
@staticmethod | ||
def iter_prompt(data_dict_it, prompt, parse_fields_func): | ||
""" This method composes prompt from the multiple fields, mentioned in it. | ||
data_it: Iterator | ||
iterator of the dict, from which we can collect data. | ||
""" | ||
assert(callable(parse_fields_func)) | ||
field_names = list(parse_fields_func(prompt)) | ||
for row_id, data_dict in enumerate(data_dict_it): | ||
assert(isinstance(data_dict, dict)) | ||
fmt_d = {col_name: data_dict[col_name] for col_name in field_names} | ||
yield row_id, prompt.format(**fmt_d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
arekit==0.25.0 | ||
source-iter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
text | ||
It was in July, 1805, and the speaker was the well-known Anna Pávlovna | ||
Schérer, maid of honor and favorite of the Empress Márya Fëdorovna. | ||
With these words she greeted Prince Vasíli Kurágin, a man of high | ||
rank and importance, who was the first to arrive at her reception. Anna | ||
Pávlovna had had a cough for some days. She was, as she said, suffering | ||
from la grippe; grippe being then a new word in St. Petersburg, used only by the elite. |