我有一个包含并列连词的短语列表,如(和、或、/、&)。我想将它们中的每一个扩展到所有可能的单独短语。扩展包含连词的短语的最佳方法是什么?使用 NLP 库或 python 函数。喜欢" alphabet a/b/c can have color red/blue/green"。这可以扩展到九个短语[" alphabet a can have color red", "alphabet a can have color blue",... "alphabet b can have color blue",..."alphabet c can have color green"].
其他示例:
['bag of apples/oranges', 'case of citrus (lemon or limes)',
'chocolates/candy box' , 'bag of shoes & socks',
'pear red/brown/green', 'match box and/or lighter',
'milkshake (soy and almond) added ']
应该将其扩展为
['bag of apples','bag of oranges',
'case of citrus lemon', 'case of citrus limes',
'chocolates box' , 'candy box' ,'bag of socks',
'bag of shoes', 'pear red', 'pear brown',
'pear green', 'match box ', 'lighter',
'milkshake almond added', 'milkshake soy added']
慕侠2389804
慕的地6264312
随时随地看视频慕课网APP
相关分类