Has anyone already written a pydelphin script coverting type comments to docstrings? So I don’t repeat the work.
Maybe that’s not even possible because there is no way of telling where the comment belongs.
I think @bond would be the best bet here. I don’t see a script in Jacy’s repo, but here’s a commit demonstrating the changes made (which may have been manual): added comments to utterances and fragments · delph-in/jacy@6da2cfa · GitHub
Not definitively, but if your TDL follows some conventions, you can exploit them as heuristics. The delphin.tdl.iterparse() function in PyDelphin returns triples of (event, obj, lineno), so, e.g., if you see a sequence of LineComment
events or a BlockComment
event immediately before a TypeDefinition
event (maybe also comparing the line numbers to make sure there isn’t a big gap between them), then you can work towards merging the objects. But, honestly, I think this would hit a lot of false positives and you’d have to do some cleanup. It might be easier to just do it manually and save the time you’d spend implementing a solution in code.
Yes, @goodmami I did more or less what you described, and it’s not perfect and does require cleanup but perhaps it’s better than having to do it all by hand in the SRG because it is kind of big…