dev #10
|
@ -33,7 +33,9 @@ def get_conf_stage(
|
|||
fn, parser_model = processed_dict[parser]
|
||||
fn(parser_model, conf_stage.parsers[idx])
|
||||
jon-lee marked this conversation as resolved
Outdated
|
||||
elif parser == "diff":
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
Do we need to support both kinds of names? Do we need to support both kinds of names?
李衍志523370910113
commented
probably yes, since it is easy for new ta to type it wrong probably yes, since it is easy for new ta to type it wrong
张泊明518370910136
commented
parsers name should be a str enum, force them to use the correct names parsers name should be a str enum, force them to use the correct names
李衍志523370910113
commented
ok, then removed. ok, then removed.
|
||||
fix_diff(task_stage, task_conf, conf_stage.parsers[idx], conf_stage)
|
||||
fix_diff(
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
underscore underscore
李衍志523370910113
commented
fixed fixed
|
||||
task_stage, task_conf, conf_stage.parsers[idx], conf_stage.executor
|
||||
)
|
||||
else:
|
||||
continue
|
||||
return conf_stage
|
||||
|
@ -88,7 +90,7 @@ def get_executor_with(
|
|||
|
||||
|
||||
def fix_keyword(
|
||||
keyword_config: task.ParserKeyword, keyword_parser_: result.Parser
|
||||
keyword_config: task.ParserKeyword, keyword_parser: result.Parser
|
||||
) -> None:
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
The reason for the suffix in The reason for the suffix in `keyword_parser_`?
李衍志523370910113
commented
just forgot to remove, sorry just forgot to remove, sorry
|
||||
keyword_weight: List[result.KeywordConfig] = []
|
||||
unique_weight = list(set(keyword_config.weight))
|
||||
|
@ -102,7 +104,7 @@ def fix_keyword(
|
|||
else:
|
||||
continue
|
||||
|
||||
keyword_parser_.with_.update(
|
||||
keyword_parser.with_.update(
|
||||
result.KeywordMatchConfig(
|
||||
matches=keyword_weight,
|
||||
).model_dump(by_alias=True)
|
||||
|
@ -134,8 +136,6 @@ def fix_dummy(
|
|||
dummy_parser_config: task.ParserDummy, dummy_parser: result.Parser
|
||||
) -> None:
|
||||
# we don't use dummy parser in real application
|
||||
if dummy_parser_config is None:
|
||||
return
|
||||
dummy_parser.with_.update(
|
||||
result.DummyConfig(
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
When will it be None? When will it be None?
|
||||
score=dummy_parser_config.score,
|
||||
|
@ -156,9 +156,8 @@ def fix_diff(
|
|||
task_stage: task.Stage,
|
||||
task_conf: task.Config,
|
||||
diff_parser_config: result.Parser,
|
||||
conf_stage: result.StageDetail,
|
||||
diff_executor: result.Executor,
|
||||
) -> None:
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
move move `continue` to the other branch to reduce nesting
张泊明518370910136
commented
I mean
I mean
```
if parser not in keyword_parser:
continue
```
```
if getattr(task_stage, parser, None) is None:
continue
````
```
if score != score_:
continue
````
李衍志523370910113
commented
fixed. fixed.
|
||||
diff_parser = diff_parser_config
|
||||
skip = task_stage.skip
|
||||
cases = task_stage.cases
|
||||
finalized_cases = [case for case in cases if case not in skip]
|
||||
|
@ -215,10 +214,9 @@ def fix_diff(
|
|||
)
|
||||
)
|
||||
|
||||
if diff_parser:
|
||||
diff_parser.with_.update(
|
||||
result.DiffConfig(name="diff", cases=parser_cases).model_dump(by_alias=True)
|
||||
)
|
||||
conf_stage.executor.with_.cases = stage_cases
|
||||
diff_parser_config.with_.update(
|
||||
result.DiffConfig(name="diff", cases=parser_cases).model_dump(by_alias=True)
|
||||
)
|
||||
diff_executor.with_.cases = stage_cases
|
||||
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue
Block a user
should loop through
conf_stage.parsers
here and update thewith
field according to the parser name.I think its already implemented in each of the
fix_parsers
functionsNo, do not find the parser in the
fix_xxx
function. Instead, iterate through the parsers here and decide how to fill in thewith
.resolved.
Use a dict to store parser name, field, function to process.
resolved.