Information classifying system that discovers the hierarchical structure of keywords by comparing link numbers5732259Abstract A system classifies the information added with keywords by discovering the hierarchy relation with respect to all of keywords. There is generated a relation composed of a total link number and links to other keywords and information, each for keyword. The total link numbers of two relations with links are compared with each other thereby determining a high level relation having a larger total link number and a low level relation having a lower total link number, and a hierarchy structure can be discovered by making the link from the low level relation to the high level relation ineffective. Claims What is claimed is: Description BACKGROUND OF THE INVENTION
______________________________________
function textPos object, text
global alterationM, particlesM, classificationsM, linkListM
global locationAndLinkM, hierarchicalListM
do "put text is not in" && object && "into TorF"
if TorF then
return ()
else
do "put number of lines of" && object && "into endLine"
return textPosR(object, 1, endLine, text)
end if
end textPos
function textPosR object,startLine,endLine,text
global alterationM, particlesM, classificationsM, linkListM
global locationAndLinkM, hierarchicalListM
if startLine is endLine then
--FOUND
return startLine
end if
put trunc((startLine + endLine) / 2) into midLine
do "put text is in line" && startLine && "to" && midLine &&
"of" && object && "into TorF"
if TorF then
return textPosR(object, startLine, midLine, text)
else
return textPosR(object, midLine + 1, endLine, text)
end if
end textPosR
on openStack
set textArrows to true
global classificationsM, particlesM, mode
put card field "classifications" of card "memorandum" into
classificationsM
put card field "particles" of card "memorandum" into particlesM
go to card ".about.root.about."
put "Browse" into mode
end openStack
on closeStack
global classificationsM, particlesM
put classificationsM into card field "classifications" of card
"memorandum"
put particlesM into card field "particles" of card "memorandum"
end closeStack
______________________________________
The script contains: a function "textPos" which calculates the position of a character string in a container; a handler "closeStack" which stores the value of global variable "classificationsM" and "particlesM"; and a handler "openStack" which restores the value of both global variables: "classificationsM", which memorizes all keywords; and "particlesM", which memorizes all particle's name. The script of card "memorandum" is as follows:
______________________________________
on openCard
global classificationsM, particlesM, alterationM
put classificationsM into card field "classifications"
put particlesM into card field "particles"
put alterationM into card field "alteration"
end openCard
______________________________________
When this card opened, the values of global variable "classificationsM", "particlesM" and "alterationM" are displayed. The global variable "alterationM" memorizes a alteration. The script of background "personality" is as follows:
______________________________________
on closeCard
global mode, alterationM, particlesM
global classification, particleName
if mode is "EnterParticle-2" then
normalize
put field "particleName" into particleName
if particleName is not empty then
if ">" & particleName & "<" is in particlesM then
put getNewName(particleName) into particleName
put particleName into field "particleName"
end if
set the lockText of field "particleName" to true
set the name of this card to particleName
put field "classification" into classification
put "enterParticle-3" into mode
go to background particlesBG
put "browse" into mode
else
doMenu "Delete Card"
popcard
end if
else if mode is "Browse-2" then
normalize
put "EnterParticle" into mode
put field "particleName" into particleName
put field "classification" into classification
put "enterParticle-3" into mode
go to background particlesBG
put "browse" into mode
endif
end closeCard
on normalize
put line 1 of field "classification" into field "classification"
put line 1 of field "particleName" into field "particleName"
put Line 1 of field "reference" into field "reference"
end normalize
on openCard
global mode
if mode is "EnterParticle" then
set lockText of field "particleName" to false
put "EnterParticle-2" into mode
else if mode is "Browse" then
set lockText of field "particleName" to true
put "Browse-2" into mode
end if
end openCard
function getNewName cName
global particlesM
repeat
ask quote & cName & quote & "has already exist. Please re-enter."
with cName if it is not in particlesM then
put it into cName
exit repeat
else
put it into cName
end if
end repeat
return cName
end getNewName
______________________________________
The handler "closeCard" passes a combination of a particle name and keywords to background "particlesBG". The handier "normalize" normalizes the card. The script of button "back track" of background "personality" is as follows:
______________________________________
on mouseUp
pop card
end mouseUp
______________________________________
The script of background "particlesBG" is as follows:
______________________________________
on openBackground
global mode, particleName, classification, alterationM, particlesM
if mode is "EnterParticle-3" then
--NEW?
if ">" & particleName & "<" is not in particlesM then
put ">" & particleName & "<" & return after last char of
particlesM
put ">" & particleName & "<,.sub.-- add" & return into
alterationM
doMenu "New Card"
set name of this card to ">" & particleName & "<"
put particleName into field "particleName"
else
put ">" & particleName & "<,--" & return into alterationM
end if
go to card ">" & particleName & "<"
put number of items of classification into iMax
repeat with i = 1 to iMax
put ".about." & (item i of classification) & ".about." after last char
of
alterationM
if field "classification" contains item i of classification then
put ",.sub.-- " & return after last char of alterationM
else
put ",.sub.-- add" & return after last char of alterationM
endif
end repeat
put number of items of field "classification" of this card into iMax
repeat with i = 1 to iMax
if item i of field "classification" is not in classification then
put ".about." & (item i of field "classification") & ".about.,.sub.--
del" & return
after last char of alterationM
end if
end repeat
if ".sub.-- add" is in alterationM or ".sub.-- del" is in alterationM
then
put classification into field "classification"
put "AlterateHierarchy" into mode
go to background "classificationsBG"
end if
end if
end openBackground
______________________________________
The handler "openBackground" accepts the combination of a particle name and keywords from background "personality", creates the alteration and passes the alteration to background "classificationsBG". The script of background "classificationsBG" is as follows:
__________________________________________________________________________
on openBackGround
global mode, alterationM,classificationsM,classificationName
if mode is "AlterateHierarchy" then
put number of lines of alterationM into iMax
repeat with i = 2 to iMax
put line i of alterationm into it
put first item of it into classificationName
put second item of it into sortOfAlteration
if sortOfAlteration is ".sub.-- add" then
if classificationName is not in classificationsM then
put classificationName & return after last char of classificationsM
doMenu "New Card"
set name of this card to classificationName
put classificationName into field "classificationName"
put 0 into field "totalLinkNumber"
end if
end if
end repeat
repeat with i = 2 to iMax
put first item of line i of alterationM into nextCard
go to card nextCard
alterateLinkNumber
end repeat
repeat with i = 2 to iMax
put first item of line i of alterationM into nextCard
go to card nextCard
discoverHierarchy
end repeat
end if
end openBackground
on alterateLinkNumber
global mode,alterationM
put field "classificationName" into myName
put textPos("alterationM", myName) into myLine
put second item of line myLine of alterationM into mySort
put first item of line 1 of alteration into pName
put second item of line 1 of alterationM into pSort
if pSort is ".sub.-- add" then
send "addLinkNumberOfParticle" && quote & pName & quote to field
"links" of this
card
put empty into mode
else if pSort is ".sub.-- del" then
send "deleteLinkNumberOfParticle" && quote & pName & quote to field
"links" of
this card
put empty into mode
else if pSort is ".sub.-- " then
if mySort is ".sub.-- add" then
send "addLinkNumberOfParticle" && quote & pName & quote to field
"links" of
this card
put empty into mode
else if mySort is ".sub.-- del" then
send "deleteLinkNumberOfParticle" && quote & pName & quote to field
"links" of
this card
put empty into mode
end if
else
ask "internal error"
end if
put number of lines of alterationM into iMax
repeat with i = 2 to iMax
if myLine is not i then
put line i of alterationM into it
put first item of it into cName
put second item of it into cSort
if mySort is ".sub.-- del" then
if cSort is not ".sub.-- add" then
send "deleteLinkNumberOfClassification" && quote & cName & quote to
field
"links"
end if
else if mySort is ".sub.-- add" then
if cSort is not ".sub.-- del" then
send "addLinkNumberOfClassification" && quote & cName & quote to
field
"links"
end if
else
if cSort is ".sub.-- del" then
send "deleteLinkNumberOfClassification" && quote & cName & quote to
field
"links"
else if cSort is ".sub.-- add" then
send "addLinkNumberOfClassification" && quote & cName & quote to
field
"links"
end if
end if
end if
end repeat
end alterateLinkNumber
on discoverHierarchy
global mode, alterationM
put field "totalLinkNumber" into TLC
put field "classificationName" into cName
put number of lines of field "links" of this card into iMax
repeat with i = 1 to iMax
put line i of field "links" of this card into iLink
put first item of iLink into destination
put third item of iLink into linkFlag
if first char of iLink is ">" then
put 0 into destTLC
else
put field "totalLinkNumber" 0f card destination into destTLC
end if
setLinkFlag i, cName, destination, destTLC, TLC
if destination is not in alterationM then
if linkFlag is "isHigher" then
setLowerLinkOfHigher destination
else if linkFlag is "isIncluded" or linkFlag is "isLower" then
if (TLC > destTLC and 0.9 * TLC <= destTLC) or (destTLC > TLC and
0.9 *
destTLC <= TLC) then
put textPos("field" && quote & "links" & quote &&"of card" && quote
destination & quote, cName) into fLine
put "isSame" into third item of line fLine of field "links" of card
destination
end if
else if linkFlag is "isSame" then
if 0.9 * TLC > destTLC then
put textPos("field" && quote & "links" & quote &&"of card" && quote
&
destination & quote, cName) into fLine
put "isHigher" into third item of line fLine of field "links" of
card destination
else if 0.9 * destTLC > TLC then
if destination is not in alterationM then
setLowerLinkOfHigher destination
end if
else
end if
end if
end if
end repeat
if "isHigher" is not in field "links" and cName is not in field "links"
of card ".about.root.about."
then
put cName & return after last char of field "links" of card
".about.root.about."
end if
end discoverHierarchy
on setLowerLinkOfHigher linkName
put field "totalLinkNumber" of card linkName into TLC
put number of lines of field "links" of card linkName into iMax
repeat with i = 1 to iMax
put line i of field "links" of card linkName into iLink
put first item of iLink into destination
put third item of iLink into linkFlag
if first char of iLink is ">" then
put 0 into destTLC
else
put field "totalLinkNumber" of card destination into destTLC
end if
if linkFlag is "isLower" or linkFlag is "isIncluded" then
setLinkFlag i, linkName, destination, destTLC, TLC
end if
end repeat
end setLowerLinkOfHigher
on setLinkFlag i, source, destination, destTLC, TLC
if 0.9 * destTLC > TLC then
put "isHigher" into third item of line i of field "links" of card
source
else if 0.9 * TLC > destTLC then
if isIncludedLink(source, destination, TLC, destTLC) then
put "isIncluded" into third item of line i of field "links" of card
source
else
put "isLower" into third item of line i of field "links" of card
source
end if
else
put "isSame" into third item of line i of field "links" of card
source
end if
end setLinkFlag
function isIncludedLink cName, destination1, TLC, dest1TLC
put number of lines of field "links" of card cName into iMax
repeat with i = 1 to iMax
put line i of field "links" of card cName into iLink
put first item of iLink into destination2
put third item of iLink into linkFlag
-calculate total link number of destination card
if first char of iLink is ">" then
-destination2 links to a particle
put 0 into dest2TLC
else
-destination2 links to a relation
put field "totalLinkNumber" of card destination2 into dest2TLC
end if
if destination1 is not destination2 and 0.9 * TLC > dest2TLC and 0.9 *
dest2TLC >
dest1TLC then
-Does item i of link array of field "links" of card cName link to
destination1?
if destination1 is in field "links" of card destination2 then
return true
end if
end if
end repeat
return false
end isIncludedlink
on makeUpCard
global classificationsM
lock screen
put second word of the name of this card into wName
put number of chars of wName into wk
put char 3 to wk - 2 of wName into field "makeupedName"
if ".about.root.about." is in wName then
put empty into lowerLink
put empty into candidate
put number of lines of field "links" into iMax
repeat with i = 1 to iMax
put item 1 of line i of field "links" into cName
if cName is in classificationsM then
if "isHigher" is not in field "links" of card cName then
put field "totalLinkNumber" of card cName into TLC
put itozi(TLC) &"," & cName & return after last char of candidate
put cName & return after last char of lowerLink
end if
end if
end repeat
put lowerLink into field "links"
else
put empty into candidate
put number of lines of field "links" into iMax
repeat with i = 1 to iMax
if third item of line i of field "links" is "isLower" then
put item 1 of line i of fieid "links" into cName
put item 2 of line i of field "links" into LC
put itozi(LC) &"," & cName & return after last char of candidate
end if
end repeat
end if
sort candidate descending text
put 8 into magicNumber
put number of lines of candidate into cnum
global nameLocOfButtonField
put 3 into nameLocOfButtonField
repeat with i = 1 to magicNumber
put empty into field ("button" & i)
if i <= cnum then
put item 2 of line i of candidate into wk
put number of chars of wk into nChar
put char 2 to nChar - 1 of wk into fName
put fName into line nameLocOfButtonField of field ("button" & i)
if first char of wk is ".about." then
-case relation
put "(keyword)" into line nameLocOfButtonField + 1of field ("button" &
i)
end if
end if
end repeat
In the following, relation A is a current relation and relation A has a link to relation B. The script comprises: 1. a handler "openBackground" which modifies link numbers and discovers the hierarchical structure of keywords; 2. a handler "alterateLinkNumber" which modifies link numbers; 3. a handler "discoverHierarchy" which discovers the hierarchical structure of keywords; 4. a handler "setLowerLinkOfHigher" which sets flags of relation B's "isLower" and "isIncluded" links; 5. a handler "setLinkFlag" which sets flags of a relation's link; 6. a function "isIncludedLink" which examines whether a link to relation B is an "isIncluded" link; p1 7. a handler "makeupCard" which makes-up cards of this background. The name of first card of background "classificationsBG" is ".about.root.about.". The script of field "links" of background "classificationsBG" is as follows:
______________________________________
on addLinkNumberOfClassification cName
put textPos("field" && quote & "links" & quote, cName) into tLine
if tLine is 0 then
put cName & ",1,null" & return after last char of me
else
put second item of line tLine of me into linkNumber
add 1 to second item of line tLine of me
end if
add 1 to field "totalLinkNumber" of this card
end addLinkNumberOfClassification
on deleteLinkNumberOfClassification cName
put textPos("field" && quote & "links" & quote, cName) into tLine
if tLine is 0 then
ask "internal error"
put empty into dummy
end if
put second item of line tLine of me into linkNumber
if linkNumber is 1 then
delete line tLine of me
else
subtract 1 from the second item of line tLine of me
end if
subtract 1 from field "totalLinkNumber" of this card
if field "totalLinkNumber" of this card is 0 then
changeThisCardToGarbage
end if
end deleteLinkNumberOfClassification
on changeThisCardToGarbage
global classificationsM
choose brush tool
drag from 20,20 to 490,360
drag from 490,20 to 20,360
choose browse tool
put textPos("classificationsM", field "classificationName") into tLine
delete line tLine of classificationsM
set the name of this card to ".sub.-- garbage.sub.-- "
end changeThisCardToGarbage
on addLinkNumberOfParticle pName
put textPos("field" && quote & "links" & quote, pName) into tLine
if tLine is 0 then
put pName & ",1,null" & return after last char of me
add 1 to field "totalLinkNumber" of this card
else
ask "internal error"
put empty into dummy
end if
end addLinkNumberOfParticle
on deleteLinkNumberOfParticle pName
put textPos("field" && quote & "links" & quote, pName) into tLine
if tLine is 0 then
ask "internal error"
end if
delete line tLine of me
subtract 1 from field "totalLinkNumber" of this card
if field "totalLinkNumber" of this card is 0 then
changeThisCardToGarbage
end if
end deleteLinkNumberOfParticle
______________________________________
The script comprises handlers which increment or decrement link numbers. The script of field "others" of background "classificationsBG" is as follows:
______________________________________
on mouseUp
push card
put the clickLine into object
do "put" && object && "into wk"
put number of chars of wk into nChar
if first char of wk is ".about." then
put wk into cName
else
put char 2 to nChar - 1 of wk into cName
end if
hide me
go to card cName
end mouseUp
______________________________________
The script of field "otherButton" of background "classificationsBG" is as follows:
______________________________________
on mouseUp
if the style of me is rectangle then
show field "others"
end if
end mouseUp
______________________________________
The script displays field "others". The script of field from "button1" to "button8" is as follows:
______________________________________
on mouseUp
push card
put empty into cName
put number of lines of me into iMax
repeat with i = 1 to iMax
if line i of me is not empty then
put line i of me into cName
exit repeat
end if
end repeat
if cName is not empty then
if "(keyword)" is not in me then
go to card cName
else
go to card ".about." & cName & ".about."
end if
end if
end mouseUp
______________________________________
The script of button "backtrack" of background "classificationsBG" is as follows:
______________________________________
on mouseUp
pop card
end mouseUp
______________________________________
The script of field "new card" of background "classificationsBG" is as follows:
______________________________________
on mouseUp
global mode
push card
put empty into mode
go to background "personality"
put "EnterParticle" into mode
doMenu "New Card"
end mouseUp
______________________________________
The invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. The present embodiment is therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Also it is to be understood that the phraseology or terminology employed herein is for the purpose of description and not of limitation.
|
Same subclass Same class Consider this |
||||||||||
