7 Replies - 459 Views - Last Post: 12 October 2012 - 05:25 PM Rate Topic: ****- 1 Votes

#1 bcnafegar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 13-May 11

Using Boost to identify locations in text file

Posted 05 October 2012 - 02:35 PM

I have a new project that calls for me to use Boost to identify locations in a text file. The could be cities, states, countries etc..but also things such as "I'll be at home" where home will be <highlighted> like this. In the example this is what he showed:
"My class starts at 10am tomorrow."

After processing, it should be tagged as:

"My class starts <time>10am</time> <time>tomorrow</time>."
this example is for those identifying time, but i'm doing locations.

I believe I downloaded boost and Regex but I am not sure yet. Can anyone give me a quick way to just test boost and regex so I know its working right so i can start figuring out how I going to code the rest. Any tips using Boost and Regex would also be very helpful.
Thanks in advance

Is This A Good Question/Topic? 0
  • +

Replies To: Using Boost to identify locations in text file

#2 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1132
  • View blog
  • Posts: 2,490
  • Joined: 05-May 05

Re: Using Boost to identify locations in text file

Posted 05 October 2012 - 03:27 PM

Quote

I believe I downloaded boost and Regex but I am not sure yet.


What do you mean you're not sure? Can you run code that calls the Boost API?

Quote

Any tips using Boost and Regex would also be very helpful.


Boost Regex Docs
Was This Post Helpful? 0
  • +
  • -

#3 bcnafegar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 13-May 11

Re: Using Boost to identify locations in text file

Posted 10 October 2012 - 04:29 PM

Ok I've downloaded ad supposedly installed Boost and regex using Boostpro, the 64-bit version. I followed the example
on boost.org. The first example using boost/lambda worked fine. When i continue with the examples i try compiling using regex. I followed the instructions but when i try and compile the second example i get 3 errors:

1>example.obj : error LNK2019: unresolved external symbol "private: class boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > > & __thiscall boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >::do_assign(char const *,char const *,unsigned int)" (?do_assign@?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@boost@@AAEAAV12@PBD0I@Z) referenced in function "public: class boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > > & __thiscall boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >::assign(char const *,char const *,unsigned int)" (?assign@?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@boost@@QAEAAV12@PBD0I@Z)

1>example.obj : error LNK2019: unresolved external symbol "public: bool __thiscall boost::re_detail::perl_matcher<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<struct boost::sub_match<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >::match(void)" (?match@?$perl_matcher@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@U?$sub_match@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@boost@@@2@U?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@re_detail@boost@@QAE_NXZ) referenced in function "bool __cdecl boost::regex_match<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<struct boost::sub_match<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> > > >,char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >(class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class boost::match_results<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<struct boost::sub_match<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> > > > > &,class boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > > const &,enum boost::regex_constants::_match_flags)" (??$regex_match@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@U?$sub_match@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@boost@@@2@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@boost@@YA_NV?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0AAV?$match_results@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@U?$sub_match@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@boost@@@2@@0@ABV?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@0@W4_match_flags@regex_constants@0@@Z)

1>example.obj : error LNK2019: unresolved external symbol "private: void __thiscall boost::re_detail::perl_matcher<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<struct boost::sub_match<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >::construct_init(class boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > > const &,enum boost::regex_constants::_match_flags)" (?construct_init@?$perl_matcher@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@U?$sub_match@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@boost@@@2@U?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@re_detail@boost@@AAEXABV?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@3@W4_match_flags@regex_constants@3@@Z) referenced in function "public: __thiscall boost::re_detail::perl_matcher<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<struct boost::sub_match<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >::perl_matcher<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<struct boost::sub_match<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> > > >,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > >(class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class boost::match_results<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<struct boost::sub_match<class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> > > > > &,class boost::basic_regex<char,struct boost::regex_traits<char,class boost::w32_regex_traits<char> > > const &,enum boost::regex_constants::_match_flags,class std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0?$perl_matcher@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@U?$sub_match@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@boost@@@2@U?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@re_detail@boost@@QAE@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0AAV?$match_results@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@U?$sub_match@V?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@boost@@@2@@2@ABV?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@2@W4_match_flags@regex_constants@2@0@Z)


any ideas on what i did wrong?sorry about the long errors
Was This Post Helpful? 0
  • +
  • -

#4 jimblumberg  Icon User is offline

  • member icon


Reputation: 3846
  • View blog
  • Posts: 11,775
  • Joined: 25-December 09

Re: Using Boost to identify locations in text file

Posted 10 October 2012 - 06:23 PM

Did you add the boost libraries to your project. The first several errors are linker errors which probably means that you didn't properly add the libraries to the project.

Jim
Was This Post Helpful? 0
  • +
  • -

#5 bcnafegar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 13-May 11

Re: Using Boost to identify locations in text file

Posted 10 October 2012 - 06:26 PM

As far as i know i did. I copied and pasted the example from boost.org, i changed paths in properties of the example project as explained...is this what your meaning?
Was This Post Helpful? 0
  • +
  • -

#6 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3178
  • View blog
  • Posts: 9,635
  • Joined: 05-May 12

Re: Using Boost to identify locations in text file

Posted 10 October 2012 - 10:19 PM

Did you download or build the Regex library as indicated is step 5? Did you change the lib path as indicated in step 6?
http://www.boost.org...ed/windows.html
Was This Post Helpful? 0
  • +
  • -

#7 bcnafegar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 13-May 11

Re: Using Boost to identify locations in text file

Posted 11 October 2012 - 10:32 AM

I got everything figured out. I searched youtube and a guy walks you through building it manually and it worked.
Now I have to learn boost to read in a file and highlight " < >" locations. Just to be sure, the assignment call for a comprehensive list of locations to be hiighlighted using regex. Does that mean i wouldhave to read each text file and use regex to find them. The assignment says I can't use a simple string match....
Was This Post Helpful? 0
  • +
  • -

#8 bcnafegar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 13-May 11

Re: Using Boost to identify locations in text file

Posted 12 October 2012 - 05:25 PM

well i figured out how to identify words using regex search and format them the way i need. Its a good start.Now I'm trying to think of ways to maybe identify every possible state. Also anyone know a good place with lots of regex syntax, like how can i get regex to identify city, state combos...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1