Apply ListType transformation to the children of a given Ngram ( #217 )
@anoe I think I have successfully managed to reproduce #217 (closed) via a minimal test case, that this patch includes. By running the test, we could see the problem: as you and @cgenie guessed, it seems like the patch is correctly turning the root into a StopTerm
, but not the children:
expected: Just (
fromList [
(
NgramsTerm {unNgramsTerm = "advantage"}
,NgramsRepoElement {
_nre_size = 1
, _nre_list = StopTerm
, _nre_root = Just (NgramsTerm {unNgramsTerm = "advantages"})
, _nre_parent = Just (NgramsTerm {unNgramsTerm = "advantages"})
, _nre_children = MSet (fromList [])
}
)
,(
NgramsTerm {unNgramsTerm = "advantages"}
,NgramsRepoElement {
_nre_size = 1
, _nre_list = StopTerm
, _nre_root = Nothing
, _nre_parent = Nothing
, _nre_children = MSet (fromList [(NgramsTerm {unNgramsTerm = "advantage"},())])
}
)
]
)
but got: Just (
fromList [
(
NgramsTerm {unNgramsTerm = "advantage"}
,NgramsRepoElement {
_nre_size = 1
, _nre_list = MapTerm
, _nre_root = Just (NgramsTerm {unNgramsTerm = "advantages"})
, _nre_parent = Just (NgramsTerm {unNgramsTerm = "advantages"})
, _nre_children = MSet (fromList [])
}
)
,(
NgramsTerm {unNgramsTerm = "advantages"}
,NgramsRepoElement {
_nre_size = 1
, _nre_list = StopTerm
, _nre_root = Nothing
, _nre_parent = Nothing
, _nre_children = MSet (fromList [(NgramsTerm {unNgramsTerm = "advantage"},())])
}
)
]
)
I'm out of time for this week and I'll investigate this further next week, but I think that as far as this comment goes, the Applicable
is certainly not problematic here, as my test checks that we can apply this patch (and that part works), but yet the patch is applied incorrectly. I suspect we might need to take a look at the instance Action
we defined and carefully analyse in which order they are called.
This begs the question about when this regression happened -- IIUC, this used to work before, right?