<commit_before>--[[
  This file is part of ClearTables

  @author <NAME> <<EMAIL>>
  @copyright 2015 <NAME>, MIT license
]]--

require "common"

function accept_water_area (tags)
    return tags["natural"] == "water" or tags["waterway"] == "riverbank" or tags["landuse"] == "reservoir"
end

function transform_water_area (tags)
    cols = {}
    cols["water"] = tags["water"] or (tags["waterway"] == "riverbank" and "river") or (tags["landuse"] == "reservoir" and "reservoir") or nil
    cols["name"] = tags["name"]
    return cols
end

function accept_waterway (tags)
    return tags["waterway"] == "stream" or tags["waterway"] == "river" or tags["waterway"] == "ditch"
        or tags["waterway"] == "canal" or tags["waterway"] == "drain"
end

function transform_waterway (tags)
    cols = {}
    cols["name"] = tags["name"]
    cols["waterway"] = tags["waterway"]
    cols["bridge"] = yesno(tags["bridge"])
    cols["tunnel"] = yesno(tags["tunnel"])
    return cols
end

function water_area_ways (tags, num_keys)
    return generic_polygon_way(tags, accept_water_area, transform_water_area)
end

function water_area_rels (tags, num_keys)
    if (tags["type"] == "multipolygon" and accept_water_area(tags)) then
        return 0, tags
    end
    return 1, {}
end

function water_area_rel_members (tags, member_tags, member_roles, membercount)
    return generic_multipolygon_members(tags, member_tags, membercount, accept_water_area, transform_water_area)
end

function waterway_ways (tags, num_keys)
    return generic_line_way(tags, accept_waterway, transform_waterway)
end
<commit_msg>Use local vars in functions<commit_after>--[[
  This file is part of ClearTables

  @author <NAME> <<EMAIL>>
  @copyright 2015 <NAME>, MIT license
]]--

require "common"

function accept_water_area (tags)
    return tags["natural"] == "water" or tags["waterway"] == "riverbank" or tags["landuse"] == "reservoir"
end

function transform_water_area (tags)
    local cols = {}
    cols["water"] = tags["water"] or (tags["waterway"] == "riverbank" and "river") or (tags["landuse"] == "reservoir" and "reservoir") or nil
    cols["name"] = tags["name"]
    return cols
end

function accept_waterway (tags)
    return tags["waterway"] == "stream" or tags["waterway"] == "river" or tags["waterway"] == "ditch"
        or tags["waterway"] == "canal" or tags["waterway"] == "drain"
end

function transform_waterway (tags)
    local cols = {}
    cols["name"] = tags["name"]
    cols["waterway"] = tags["waterway"]
    cols["bridge"] = yesno(tags["bridge"])
    cols["tunnel"] = yesno(tags["tunnel"])
    return cols
end

function water_area_ways (tags, num_keys)
    return generic_polygon_way(tags, accept_water_area, transform_water_area)
end

function water_area_rels (tags, num_keys)
    if (tags["type"] == "multipolygon" and accept_water_area(tags)) then
        return 0, tags
    end
    return 1, {}
end

function water_area_rel_members (tags, member_tags, member_roles, membercount)
    return generic_multipolygon_members(tags, member_tags, membercount, accept_water_area, transform_water_area)
end

function waterway_ways (tags, num_keys)
    return generic_line_way(tags, accept_waterway, transform_waterway)
end

{'fraction_non_alphanumeric': 0.14214463840399003, 'fraction_numerical': 0.003740648379052369, 'mean_word_length': 4.953617810760668, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3970906', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1046, 'n_words': 276}