I solve it.
//~ app.document.keywordsManager.addKeyword (keywordPath:String, useHierarchicalPath:Bollean)
//~ app.document.keywordsManager.deleteKeyword (keywordPath:String, useHierarchicalPath:Bollean)
//~ app.document.keywordsManager.renameKeyword (oldName:String, newName:String, useHierarchicalPath:Bollean)
//~ app.document.keywordsManager.serializeToXML()
Note regarding sub keywords creation:
when useHierarchicalPath is true, the function will seek the keywordPath string and if it detects a vertical slash (for example "aaa|bbb") that means a keyword "aaa" and a sub keyword "bbb" will be created. "aaa" is created if doesn't exist.
This is the same logic used on deleteKeyword and renameKeyword.
Examples:
addKeyword
app.document.keywordsManager.addKeyword ("some words", true); // adds the keyword "some words"
app.document.keywordsManager.addKeyword ("things|some words", true); // adds the keyword "things" and the sub keyword "some words"
app.document.keywordsManager.addKeyword ("things|some words", false); // this adds the keyword "things|some words" and ignores the vertical dash
deleteKeyword
app.document.keywordsManager.deleteKeyword ("aaa|bbb", true); // delets the sub keyword "bbb"
app.document.keywordsManager.deleteKeyword ("aaa", true); // delets the keyword "aaa" and all its sub keywords
renameKeyword
app.document.keywordsManager.renameKeyword ("aaa|bbb", "aaa|ccc", true); // rename the sub keyword "bbb" to "ccc"
app.document.keywordsManager.renameKeyword ("aaa", "a11", true); // rename the keyword "aaa" to "a11"
serializeToXML
app.document.keywordsManager.serializeToXML(); // returns the xml of all the keywords structure