File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010# Project
1111cmake_minimum_required (VERSION 3.1 FATAL_ERROR )
12- project (spacy-cpp VERSION 1.03 LANGUAGES CXX )
12+ project (spacy-cpp VERSION 1.04 LANGUAGES CXX )
1313set (CMAKE_CXX_STANDARD 11)
1414if (MSVC )
1515 if (CMAKE_CXX_FLAGS MATCHES "/W[0-4]" )
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import spacy
3333nlp = spacy.load(" en_core_web_sm" )
3434doc = nlp(u " This is a sentence." )
3535for token in doc:
36- print token.text + " [" + token.pos_ + " ]"
36+ print ( token.text + " [" + token.pos_ + " ]" )
3737```
3838
3939
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ namespace Spacy
2727 PyObjectPtr text (Python::get_object<std::string>(p_text));
2828 std::vector<PyObjectPtr> args = std::vector<PyObjectPtr>({text});
2929 PyObjectPtr doc (Python::call_method<PyObjectPtr>(m_nlp, args));
30- return Doc ( doc) ;
30+ return doc;
3131 }
3232
3333 Vocab Nlp::vocab () const
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ namespace Spacy
2525 {
2626 if (m_spacy.get () == nullptr )
2727 {
28- throw std::runtime_error (" No module named spacy. Try: pip install -U spacy" );
28+ throw std::runtime_error (" No module named spacy. Try: pip3 install -U spacy" );
2929 }
3030 }
3131
@@ -41,9 +41,9 @@ namespace Spacy
4141 if (nlp.get () == nullptr )
4242 {
4343 throw std::runtime_error (" Can't find model '" + p_model + " '. "
44- " Try: python -m spacy download " + p_model);
44+ " Try: python3 -m spacy download " + p_model);
4545 }
46- return Nlp ( nlp) ;
46+ return nlp;
4747 }
4848
4949 const Attrs& Spacy::attrs ()
Original file line number Diff line number Diff line change @@ -223,9 +223,9 @@ namespace Spacy
223223 return Python::get_attr_value<double >(m_token, " prob" );
224224 }
225225
226- long Token::rank () const
226+ double Token::rank () const
227227 {
228- return Python::get_attr_value<long >(m_token, " rank" );
228+ return Python::get_attr_value<double >(m_token, " rank" );
229229 }
230230
231231 double Token::sentiment () const
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ namespace Spacy
6969 long pos () const ;
7070 std::string pos_ () const ;
7171 double prob () const ;
72- long rank () const ;
72+ double rank () const ;
7373 double sentiment () const ;
7474 long shape () const ;
7575 std::string shape_ () const ;
Original file line number Diff line number Diff line change @@ -385,7 +385,7 @@ int main()
385385 Spacy::Token back = doc.tokens ().at (2 );
386386 unittest::ExpectEqual (std::string, give.tag_ (), " VB" );
387387 unittest::ExpectEqual (std::string, it.tag_ (), " PRP" );
388- unittest::ExpectEqual (std::string, back.tag_ (), " RP " );
388+ unittest::ExpectEqual (std::string, back.tag_ (), " RB " );
389389 }
390390
391391 // Token::text
You can’t perform that action at this time.
0 commit comments