src/Generic/SPropTrees/STreeNode.cpp
/*same but the node is APPENDED to a wstring
*/
same but the node is APPENDED to a wstring
same but the node is APPENDED to a wstring
void STreeNode::serialize(std::wstring& wstr, int depth) const {
	if ( ! _content || ! _isGood ) return;
	SNodeContent::ContentType ntype=_content->getType();
	if ( ntype == SNodeContent::EMPTY ) return;
	std::wstring r=_role[0] == '<' ? _role : std::wstring(L"<") + _role + L">";
	for ( int i=0; i < depth; i++ ) wstr += L"\t";
	wstr += L"(";
	wstr += r;
	if ( ntype == SNodeContent::PROPOSITION ) {
		wstr += L"\tP\t";
		std::wostringstream s;
		s << _content->getProposition()->getID();
		wstr += s.str();
	} else if ( ntype == SNodeContent::ENTITY ) {
		wstr += L"\tE\t";
		std::wostringstream s;
		s << _content->getEntity()->getID();
		wstr += s.str();
	} else { 
		wstr += L"\tT\t0";
	}
	wstr += L"\t";
	std::wostringstream s;
	s << size;
	wstr += s.str();
	wstr += L"\t(";
	AltMentions::const_iterator amci;
	size_t n=0;
	for ( amci = _content->_theMentions.begin(); amci != _content->_theMentions.end(); amci++ ) {
		wstr += L"(";
		std::wostringstream s;
		s << amci->first->getUID();
		wstr += s.str();
		wstr += L")";
		n++;
		if ( n < _content->_theMentions.size() ) wstr += L"\t";
	}
	wstr += L")";
	if ( _parts.size() ) {
		wstr += L"\t(\n";
		Roles::const_iterator rci;
		for ( rci = _parts.begin(); rci != _parts.end(); rci++ ) rci->second->serialize(wstr,depth+1);
		for ( int i=0; i < depth; i++ ) wstr += L"\t";
		wstr += L")";
	}
	wstr += L")\n";
}
void STreeNode :: serialize ( std :: wstring & wstr , int depth ) const { if ( ! _content || ! _isGood ) return ; SNodeContent :: ContentType ntype = _content -> getType ( ) ; if ( ntype == SNodeContent :: EMPTY ) return ; std :: wstring r = _role [ 0 ] == ' ' ? _role : std :: wstring ( L" " ) + _role + L" " ; for ( int i = 0 ; i < depth ; i ++ ) wstr += L" \t " ; wstr += L" " ; wstr += r ; if ( ntype == SNodeContent :: PROPOSITION ) { wstr += L" \t \t " ; std :: wostringstream s ; s << _content -> getProposition ( ) -> getID ( ) ; wstr += s . str ( ) ; } else if ( ntype == SNodeContent :: ENTITY ) { wstr += L" \t \t " ; std :: wostringstream s ; s << _content -> getEntity ( ) -> getID ( ) ; wstr += s . str ( ) ; } else { wstr += L" \t \t " ; } wstr += L" \t " ; std :: wostringstream s ; s << size ; wstr += s . str ( ) ; wstr += L" \t " ; AltMentions :: const_iterator amci ; size_t n = 0 ; for ( amci = _content -> _theMentions . begin ( ) ; amci != _content -> _theMentions . end ( ) ; amci ++ ) { wstr += L" " ; std :: wostringstream s ; s << amci -> first -> getUID ( ) ; wstr += s . str ( ) ; wstr += L" " ; n ++ ; if ( n < _content -> _theMentions . size ( ) ) wstr += L" \t " ; } wstr += L" " ; if ( _parts . size ( ) ) { wstr += L" \t \n " ; Roles :: const_iterator rci ; for ( rci = _parts . begin ( ) ; rci != _parts . end ( ) ; rci ++ ) rci -> second -> serialize ( wstr , depth + 1 ) ; for ( int i = 0 ; i < depth ; i ++ ) wstr += L" \t " ; wstr += L" " ; } wstr += L" \n " ; }
same but the node is APPENDED to a wstring
same but the node is APPENDED to a wstring
//if ( ntype == SNodeContent::PHRASE ) {
