我可以使用 spacy 识别字符串中的“问题词”谁、如何、何时...吗?

问题描述

我有一个字符串

updated_df = pd.DataFrame()

with requests.Session() as connection_session:  # reuse your connection!
    for follow_url in get_follow_urls(get_main_urls(),connection_session):
        key = follow_url.rsplit("/")[-1].replace(".html","")
        # print(f"Fetching data for {key}...")
        dfs = pd.read_html(
            connection_session.get(follow_url).content.decode("utf-8"),flavor="bs4",)
        # https://stackoverflow.com/questions/39710903/pd-read-html-imports-a-list-rather-than-a-dataframe
        for df in dfs:
            df = dfs[0].T.iloc[1:,:].copy()
            updated_df = updated_df.append(df)
            print(updated_df)

cols = ['项目编号','转让/出租标的名称','转让方/出租方名称','转让标的评估价/年租金评估价(元)','转让底价/年租金底价(元)','受让方/承租方名称','成交价/成交年租金(元)','成交日期']
updated_df.columns = cols
updated_df.to_excel('./data.xlsx',index = False)

代码正在打印字符串的所有文本、依赖项和位置。 我想在字符串中识别疑问词“How”。

解决方法

如果您想用 using Super::iterator;#include <vector> template< class T > struct IsAType {}; template< class T > class MyVectorPublic : public std::vector< T > { using Super = std::vector< T >; public: using Super::vector; using Super::at; // function using Super::push_back; // function using Super::iterator; // type // IsAType< Super::vector > t; // }; template< class T > class MyVectorProtected : protected std::vector< T > { using Super = std::vector< T >; public: using Super::vector; using stdvec = typename Super::vector; using Super::at; // function using Super::push_back; // function using Super::iterator; // type // IsAType< Super::vector > t; // C2923 }; template< class T > class MyVectorPrivate : private std::vector< T > { using Super = std::vector< T >; public: using Super::vector; using stdvec = typename Super::vector; using Super::at; // function using Super::push_back; // function using Super::iterator; // type // IsAType< Super::vector > t; // C2923 }; int main() { auto vecPub = MyVectorPublic< int >::vector(); //auto vecProt = MyVectorProtected< int >::vector(); // C2247 //auto vecPriv = MyVectorPrivate< int >::vector(); // C2247 auto vecProt = MyVectorProtected< int >::stdvec(); auto vecPriv = MyVectorPrivate< int >::stdvec(); auto itPub = MyVectorPublic< int >::iterator(); auto itProt = MyVectorProtected< int >::iterator(); auto itPriv = MyVectorPrivate< int >::iterator(); } 查找令牌,请使用

tok.dep_ == 'advmod'

这会打印 tok.pos_ == 'ADV'

,

坚持基本知识不是更容易吗?

a = "Hello my name is Amar. How can I help you?"
Space = a.find(" ")
Q= a[:Space]

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...