Skip to content

Commit

Permalink
Commit work on new adjective structure
Browse files Browse the repository at this point in the history
  • Loading branch information
jmccrae committed Aug 8, 2024
1 parent 405d0ce commit ae4dc9a
Show file tree
Hide file tree
Showing 16 changed files with 77,095 additions and 0 deletions.
5,345 changes: 5,345 additions & 0 deletions adj/adj_0.toml

Large diffs are not rendered by default.

5,442 changes: 5,442 additions & 0 deletions adj/adj_1.toml

Large diffs are not rendered by default.

5,510 changes: 5,510 additions & 0 deletions adj/adj_10.toml

Large diffs are not rendered by default.

5,564 changes: 5,564 additions & 0 deletions adj/adj_11.toml

Large diffs are not rendered by default.

5,656 changes: 5,656 additions & 0 deletions adj/adj_12.toml

Large diffs are not rendered by default.

5,488 changes: 5,488 additions & 0 deletions adj/adj_13.toml

Large diffs are not rendered by default.

5,652 changes: 5,652 additions & 0 deletions adj/adj_2.toml

Large diffs are not rendered by default.

5,452 changes: 5,452 additions & 0 deletions adj/adj_3.toml

Large diffs are not rendered by default.

5,458 changes: 5,458 additions & 0 deletions adj/adj_4.toml

Large diffs are not rendered by default.

5,544 changes: 5,544 additions & 0 deletions adj/adj_5.toml

Large diffs are not rendered by default.

5,504 changes: 5,504 additions & 0 deletions adj/adj_6.toml

Large diffs are not rendered by default.

5,462 changes: 5,462 additions & 0 deletions adj/adj_7.toml

Large diffs are not rendered by default.

5,420 changes: 5,420 additions & 0 deletions adj/adj_8.toml

Large diffs are not rendered by default.

5,518 changes: 5,518 additions & 0 deletions adj/adj_9.toml

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions scripts/extract_adj_toml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import yaml
import toml

data = yaml.safe_load(open('src/yaml/adj.all.yaml'))

similars = {}
defs = {}
members = {}
ssids = []

for ssid, synset in data.items():
if synset['partOfSpeech'] == 's':
similars[ssid] = synset['similar'][0]
ssids.append(ssid)
elif synset['partOfSpeech'] == 'a':
ssids.append(ssid)
defs[ssid] = synset['definition'][0]
members[ssid] = synset['members']

data = {}
i = 0
for ssid in ssids:
if ssid not in similars:
data[ssid] = {'definition': defs[ssid], 'members': ", ".join(members[ssid]) }
else:
data[ssid] = {'definition': defs[ssid], 'members': ", ".join(members[ssid]) ,
'hypernym': ", ".join(members[similars[ssid]]),
'hypernym_definition': defs[similars[ssid]]}
if len(data) > 1000:
with open(f"adj/adj_{i}.toml", "w") as f:
f.write("""# - `hypernym`: For these it must be the case that "if something is X, then it is also Y". For example, if something is moribund then it is also dying.
# - `antonym`: These words have opposite meanings, they are often prefixed with 'un-' or 'dis-'. For example, if something is moral then it is not immoral.
# - `pertainym`: The word means 'of or pertaining to X' and is often morphologically related. For example, if something is 'oceanic' then it is of or pertaining to the ocean.
# - `scalar`: The adjective refers to a value on a scale. For example, 'hot' relates to 'temperature', 'wide' relates to 'width'.
# - `quality`: This refers to an abstract noun derived from the adjective, often by a suffix such as '-ness' of '-ity'. For example, 'hot' relates to 'hotness', 'wide' relates to 'wideness'.
# - `present_participle`: This means that the adjective is derived from a verb meaning performing the action currently or repeatedly. The adjective is often the '-ing' form of the verb. For example, 'running' relates to 'run'.
# - `past_participle`: This means as a result of the verb and is mostly the '-ed' form of the verb. For example, 'run' relates to 'ran'.
# - `potential`: This means that it is possible for this verb to be done to something and is often the '-able' form of the verb. For example, 'readable' relates to 'read'.
# - `lack`: The adjective means the lack of something, and often corresponds to the '-less' form of the adjective. For example, 'careless' relates to 'care'.
# - `fullness`: The adjective means being full of something, and often corresponds to the '-ful' form of the adjective. For example, 'careful' relates to 'care'.
# - `resembles`: The adjective means it resembles something, and often corresponds to the '-like' form of the adjective. For example, 'childlike' relates to 'child'.
""")
toml.dump(data, f)
data = {}
i += 1
35 changes: 35 additions & 0 deletions scripts/nvim_wordnet.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
local json = require('json')
-- Function to get the current word under the cursor and insert a message into the buffer
local function greet_current_word()
-- Get the current word under the cursor
local current_word = vim.fn.expand('<cword>')

-- If there is a word, insert the greeting message
if current_word ~= "" then
local greeting = "Hello, " .. current_word

-- Get the current cursor position
local row, col = unpack(vim.api.nvim_win_get_cursor(0))

-- Insert the greeting message at the cursor position
vim.api.nvim_put({greeting}, 'l', true, true)
else
print("No word under cursor")
end
end

-- Create a command to call the function
vim.api.nvim_create_user_command(
'GreetCurrentWord',
greet_current_word,
{ nargs = 0 }
)

-- Optionally, you can create a key mapping to call the command
vim.api.nvim_set_keymap(
'n',
'<leader>g',
':GreetCurrentWord<CR>',
{ noremap = true, silent = true }
)

0 comments on commit ae4dc9a

Please sign in to comment.