@@ -24,12 +24,17 @@ async def build_noun_graph(
2424 text_analyzer : BaseNounPhraseExtractor ,
2525 normalize_edge_weights : bool ,
2626 num_threads : int = 4 ,
27+ async_mode : AsyncType = AsyncType .Threaded ,
2728 cache : PipelineCache | None = None ,
2829) -> tuple [pd .DataFrame , pd .DataFrame ]:
2930 """Build a noun graph from text units."""
3031 text_units = text_unit_df .loc [:, ["id" , "text" ]]
3132 nodes_df = await _extract_nodes (
32- text_units , text_analyzer , num_threads = num_threads , cache = cache
33+ text_units ,
34+ text_analyzer ,
35+ num_threads = num_threads ,
36+ async_mode = async_mode ,
37+ cache = cache ,
3338 )
3439 edges_df = _extract_edges (nodes_df , normalize_edge_weights = normalize_edge_weights )
3540 return (nodes_df , edges_df )
@@ -39,6 +44,7 @@ async def _extract_nodes(
3944 text_unit_df : pd .DataFrame ,
4045 text_analyzer : BaseNounPhraseExtractor ,
4146 num_threads : int = 4 ,
47+ async_mode : AsyncType = AsyncType .Threaded ,
4248 cache : PipelineCache | None = None ,
4349) -> pd .DataFrame :
4450 """
@@ -64,7 +70,7 @@ async def extract(row):
6470 text_unit_df ,
6571 extract ,
6672 num_threads = num_threads ,
67- async_type = AsyncType . Threaded ,
73+ async_type = async_mode ,
6874 progress_msg = "extract noun phrases progress: " ,
6975 )
7076
0 commit comments