mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
Started work on the new Grammar checker system.
This commit is contained in:
parent
a055f6359d
commit
daac13b923
@ -0,0 +1,3 @@
|
|||||||
|
[folding]
|
||||||
|
|
||||||
|
sections_unfolded=PackedStringArray()
|
@ -0,0 +1,170 @@
|
|||||||
|
[editor_states]
|
||||||
|
|
||||||
|
Anim={
|
||||||
|
"visible": false
|
||||||
|
}
|
||||||
|
2D={
|
||||||
|
"grid_offset": Vector2(0, 0),
|
||||||
|
"grid_snap_active": false,
|
||||||
|
"grid_step": Vector2(8, 8),
|
||||||
|
"grid_visibility": 1,
|
||||||
|
"ofs": Vector2(-165, -110),
|
||||||
|
"primary_grid_steps": 8,
|
||||||
|
"show_edit_locks": true,
|
||||||
|
"show_guides": true,
|
||||||
|
"show_helpers": false,
|
||||||
|
"show_origin": true,
|
||||||
|
"show_rulers": true,
|
||||||
|
"show_transformation_gizmos": true,
|
||||||
|
"show_viewport": true,
|
||||||
|
"show_zoom_control": true,
|
||||||
|
"smart_snap_active": false,
|
||||||
|
"snap_guides": true,
|
||||||
|
"snap_node_anchors": true,
|
||||||
|
"snap_node_center": true,
|
||||||
|
"snap_node_parent": true,
|
||||||
|
"snap_node_sides": true,
|
||||||
|
"snap_other_nodes": true,
|
||||||
|
"snap_pixel": true,
|
||||||
|
"snap_relative": false,
|
||||||
|
"snap_rotation": false,
|
||||||
|
"snap_rotation_offset": 0.0,
|
||||||
|
"snap_rotation_step": 0.261799,
|
||||||
|
"snap_scale": false,
|
||||||
|
"snap_scale_step": 0.1,
|
||||||
|
"zoom": 1.0
|
||||||
|
}
|
||||||
|
3D={
|
||||||
|
"fov": 70.01,
|
||||||
|
"gizmos_status": {
|
||||||
|
"AudioListener3D": 0,
|
||||||
|
"AudioStreamPlayer3D": 0,
|
||||||
|
"CPUParticles3D": 0,
|
||||||
|
"CSGShape3D": 0,
|
||||||
|
"Camera3D": 0,
|
||||||
|
"CollisionObject3D": 0,
|
||||||
|
"CollisionPolygon3D": 0,
|
||||||
|
"CollisionShape3D": 0,
|
||||||
|
"Decal": 0,
|
||||||
|
"FogVolume": 0,
|
||||||
|
"GPUParticles3D": 0,
|
||||||
|
"GPUParticlesCollision3D": 0,
|
||||||
|
"Joint3D": 0,
|
||||||
|
"Light3D": 0,
|
||||||
|
"LightmapGI": 0,
|
||||||
|
"LightmapProbe": 0,
|
||||||
|
"Marker3D": 0,
|
||||||
|
"NavigationLink3D": 0,
|
||||||
|
"NavigationRegion3D": 0,
|
||||||
|
"OccluderInstance3D": 0,
|
||||||
|
"Path3D": 0,
|
||||||
|
"PhysicalBone3D": 0,
|
||||||
|
"RayCast3D": 0,
|
||||||
|
"ReflectionProbe": 0,
|
||||||
|
"ShapeCast3D": 0,
|
||||||
|
"Skeleton3D": 0,
|
||||||
|
"SoftBody3D": 0,
|
||||||
|
"SpringArm3D": 0,
|
||||||
|
"VehicleWheel3D": 0,
|
||||||
|
"VisibleOnScreenNotifier3D": 0,
|
||||||
|
"VoxelGI": 0
|
||||||
|
},
|
||||||
|
"local_coords": false,
|
||||||
|
"preview_sun_env": {
|
||||||
|
"environ_ao_enabled": false,
|
||||||
|
"environ_enabled": true,
|
||||||
|
"environ_energy": 1.0,
|
||||||
|
"environ_gi_enabled": false,
|
||||||
|
"environ_glow_enabled": true,
|
||||||
|
"environ_ground_color": Color(0.2, 0.169, 0.133, 1),
|
||||||
|
"environ_sky_color": Color(0.385, 0.454, 0.55, 1),
|
||||||
|
"environ_tonemap_enabled": true,
|
||||||
|
"sun_color": Color(1, 1, 1, 1),
|
||||||
|
"sun_enabled": true,
|
||||||
|
"sun_energy": 1.0,
|
||||||
|
"sun_max_distance": 100.0,
|
||||||
|
"sun_rotation": Vector2(-1.0472, 2.61799)
|
||||||
|
},
|
||||||
|
"rotate_snap": 15.0,
|
||||||
|
"scale_snap": 10.0,
|
||||||
|
"show_grid": true,
|
||||||
|
"show_origin": true,
|
||||||
|
"snap_enabled": false,
|
||||||
|
"translate_snap": 1.0,
|
||||||
|
"viewport_mode": 1,
|
||||||
|
"viewports": [{
|
||||||
|
"auto_orthogonal": false,
|
||||||
|
"auto_orthogonal_enabled": true,
|
||||||
|
"cinematic_preview": false,
|
||||||
|
"display_mode": 20,
|
||||||
|
"distance": 4.0,
|
||||||
|
"doppler": false,
|
||||||
|
"frame_time": false,
|
||||||
|
"gizmos": true,
|
||||||
|
"half_res": false,
|
||||||
|
"information": false,
|
||||||
|
"listener": true,
|
||||||
|
"position": Vector3(0, 0, 0),
|
||||||
|
"use_environment": false,
|
||||||
|
"use_orthogonal": false,
|
||||||
|
"view_type": 0,
|
||||||
|
"x_rotation": 0.5,
|
||||||
|
"y_rotation": -0.5
|
||||||
|
}, {
|
||||||
|
"auto_orthogonal": false,
|
||||||
|
"auto_orthogonal_enabled": true,
|
||||||
|
"cinematic_preview": false,
|
||||||
|
"display_mode": 20,
|
||||||
|
"distance": 4.0,
|
||||||
|
"doppler": false,
|
||||||
|
"frame_time": false,
|
||||||
|
"gizmos": true,
|
||||||
|
"half_res": false,
|
||||||
|
"information": false,
|
||||||
|
"listener": false,
|
||||||
|
"position": Vector3(0, 0, 0),
|
||||||
|
"use_environment": false,
|
||||||
|
"use_orthogonal": false,
|
||||||
|
"view_type": 0,
|
||||||
|
"x_rotation": 0.5,
|
||||||
|
"y_rotation": -0.5
|
||||||
|
}, {
|
||||||
|
"auto_orthogonal": false,
|
||||||
|
"auto_orthogonal_enabled": true,
|
||||||
|
"cinematic_preview": false,
|
||||||
|
"display_mode": 20,
|
||||||
|
"distance": 4.0,
|
||||||
|
"doppler": false,
|
||||||
|
"frame_time": false,
|
||||||
|
"gizmos": true,
|
||||||
|
"half_res": false,
|
||||||
|
"information": false,
|
||||||
|
"listener": false,
|
||||||
|
"position": Vector3(0, 0, 0),
|
||||||
|
"use_environment": false,
|
||||||
|
"use_orthogonal": false,
|
||||||
|
"view_type": 0,
|
||||||
|
"x_rotation": 0.5,
|
||||||
|
"y_rotation": -0.5
|
||||||
|
}, {
|
||||||
|
"auto_orthogonal": false,
|
||||||
|
"auto_orthogonal_enabled": true,
|
||||||
|
"cinematic_preview": false,
|
||||||
|
"display_mode": 20,
|
||||||
|
"distance": 4.0,
|
||||||
|
"doppler": false,
|
||||||
|
"frame_time": false,
|
||||||
|
"gizmos": true,
|
||||||
|
"half_res": false,
|
||||||
|
"information": false,
|
||||||
|
"listener": false,
|
||||||
|
"position": Vector3(0, 0, 0),
|
||||||
|
"use_environment": false,
|
||||||
|
"use_orthogonal": false,
|
||||||
|
"view_type": 0,
|
||||||
|
"x_rotation": 0.5,
|
||||||
|
"y_rotation": -0.5
|
||||||
|
}],
|
||||||
|
"zfar": 4000.01,
|
||||||
|
"znear": 0.05
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
[folding]
|
||||||
|
|
||||||
|
node_unfolds=[]
|
||||||
|
resource_unfolds=[]
|
||||||
|
nodes_folded=[]
|
@ -16,11 +16,11 @@ dock_5="Inspector,Node,History"
|
|||||||
|
|
||||||
[EditorNode]
|
[EditorNode]
|
||||||
|
|
||||||
open_scenes=["res://screens/MainMenu.tscn", "res://GenresSubstitution/TestDB.tscn", "res://Dialog/TestDialog.tscn"]
|
open_scenes=["res://screens/MainMenu.tscn", "res://GenresSubstitution/TestDB.tscn", "res://Dialog/TestDialog.tscn", "res://Grammar/GrammarTest.tscn"]
|
||||||
|
|
||||||
[ScriptEditor]
|
[ScriptEditor]
|
||||||
|
|
||||||
open_scripts=["res://Dialog/dialog_system.gd", "res://GenresSubstitution/genre_sub.gd"]
|
open_scripts=["res://Dialog/dialog_system.gd", "res://GenresSubstitution/genre_sub.gd", "res://Grammar/GrammarTest.gd"]
|
||||||
open_help=[]
|
open_help=[]
|
||||||
script_split_offset=150
|
script_split_offset=150
|
||||||
list_split_offset=0
|
list_split_offset=0
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
2a60927148abd1d33b818b535e306557
|
2a60927148abd1d33b818b535e306557
|
||||||
::res://::1683479383
|
::res://::1683484364
|
||||||
default_env.tres::Environment::-1::1680461469::0::1::::<><>::
|
default_env.tres::Environment::-1::1680461469::0::1::::<><>::
|
||||||
icon.png::CompressedTexture2D::1663579034843721578::1659896126::1681665020::1::::<><>::
|
icon.png::CompressedTexture2D::1663579034843721578::1659896126::1681665020::1::::<><>::
|
||||||
README.txt::TextFile::-1::1679251181::0::1::::<><>::
|
README.txt::TextFile::-1::1679251181::0::1::::<><>::
|
||||||
@ -37,19 +37,19 @@ LiberationSerif-BoldItalic.ttf::FontFile::6973589459942031632::1679252065::16816
|
|||||||
LiberationSerif-Italic.ttf::FontFile::3429051925918376143::1679252065::1681665020::1::::<><>::
|
LiberationSerif-Italic.ttf::FontFile::3429051925918376143::1679252065::1681665020::1::::<><>::
|
||||||
LiberationSerif-Regular.ttf::FontFile::3437532725077625275::1679252065::1681665020::1::::<><>::
|
LiberationSerif-Regular.ttf::FontFile::3437532725077625275::1679252065::1681665020::1::::<><>::
|
||||||
::res://CharacterCreator/::1659895857
|
::res://CharacterCreator/::1659895857
|
||||||
::res://databases/::1682876154
|
::res://databases/::1683481029
|
||||||
::res://Dialog/::1682880937
|
::res://Dialog/::1683481029
|
||||||
dialog_system.gd::GDScript::-1::1682880527::0::1::::<>Node<>::
|
dialog_system.gd::GDScript::-1::1683481028::0::1::::<>Node<>::
|
||||||
TestDialog.tscn::PackedScene::4730621496714883874::1682880937::0::1::::<><>::res://Dialog/dialog_system.gd
|
TestDialog.tscn::PackedScene::4730621496714883874::1683481029::0::1::::<><>::res://Dialog/dialog_system.gd
|
||||||
::res://GenresSubstitution/::1682880384
|
::res://GenresSubstitution/::1683481028
|
||||||
genre_sub.gd::GDScript::-1::1682880384::0::1::::<>Node<>::
|
genre_sub.gd::GDScript::-1::1682880384::0::1::::<>Node<>::
|
||||||
TestDB.tscn::PackedScene::3353206590719512815::1682274676::0::1::::<><>::res://GenresSubstitution/genre_sub.gd
|
TestDB.tscn::PackedScene::3353206590719512815::1683481028::0::1::::<><>::res://GenresSubstitution/genre_sub.gd
|
||||||
::res://GenresSubstitution/globalScripts/::1679252065
|
::res://GenresSubstitution/globalScripts/::1679252065
|
||||||
DiceRoller.gd::GDScript::-1::1679252065::0::1::::<>Control<>::
|
DiceRoller.gd::GDScript::-1::1679252065::0::1::::<>Control<>::
|
||||||
::res://Grammar/::1659895937
|
::res://Grammar/::1659895937
|
||||||
::res://RiskFactors/::1659895947
|
::res://RiskFactors/::1659895947
|
||||||
::res://screens/::1681669599
|
::res://screens/::1683481028
|
||||||
MainMenu.tscn::PackedScene::8771866178020998753::1681669599::0::1::::<><>::
|
MainMenu.tscn::PackedScene::8771866178020998753::1683481028::0::1::::<><>::
|
||||||
::res://userInterface/::1679252065
|
::res://userInterface/::1679252065
|
||||||
But_ChangeScene.gd::GDScript::-1::1679252065::0::1::::<>RefCounted<>::
|
But_ChangeScene.gd::GDScript::-1::1679252065::0::1::::<>RefCounted<>::
|
||||||
But_ChangeScene.tscn::PackedScene::-1::1679252065::0::1::::<><>::res://UserInterface/But_ChangeScene.gd
|
But_ChangeScene.tscn::PackedScene::-1::1679252065::0::1::::<><>::res://UserInterface/But_ChangeScene.gd
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
res://Dialog/TestDialog.tscn
|
res://Grammar/GrammarTest.tscn
|
||||||
res://Dialog/dialog_system.gd
|
res://Grammar/GrammarTest.gd
|
||||||
res://screens/MainMenu.tscn
|
res://screens/MainMenu.tscn
|
||||||
res://GenresSubstitution/TestDB.tscn
|
res://GenresSubstitution/TestDB.tscn
|
||||||
|
res://Dialog/TestDialog.tscn
|
||||||
|
@ -10,7 +10,7 @@ run_reload_scripts=true
|
|||||||
[recent_files]
|
[recent_files]
|
||||||
|
|
||||||
scenes=["res://Dialog/TestDialog.tscn", "res://GenresSubstitution/TestDB.tscn", "res://screens/MainMenu.tscn"]
|
scenes=["res://Dialog/TestDialog.tscn", "res://GenresSubstitution/TestDB.tscn", "res://screens/MainMenu.tscn"]
|
||||||
scripts=["res://Dialog/dialog_system.gd", "res://GenresSubstitution/genre_sub.gd"]
|
scripts=["res://Grammar/GrammarTest.gd", "res://Dialog/dialog_system.gd", "res://GenresSubstitution/genre_sub.gd"]
|
||||||
|
|
||||||
[script_setup]
|
[script_setup]
|
||||||
|
|
||||||
|
@ -19,9 +19,23 @@ state={
|
|||||||
"breakpoints": PackedInt32Array(),
|
"breakpoints": PackedInt32Array(),
|
||||||
"column": 45,
|
"column": 45,
|
||||||
"folded_lines": Array[int]([]),
|
"folded_lines": Array[int]([]),
|
||||||
"h_scroll_position": 0,
|
"h_scroll_position": 114,
|
||||||
"row": 101,
|
"row": 101,
|
||||||
"scroll_position": 79.0,
|
"scroll_position": 66.0,
|
||||||
|
"selection": false,
|
||||||
|
"syntax_highlighter": "GDScript"
|
||||||
|
}
|
||||||
|
|
||||||
|
[res://Grammar/GrammarTest.gd]
|
||||||
|
|
||||||
|
state={
|
||||||
|
"bookmarks": PackedInt32Array(),
|
||||||
|
"breakpoints": PackedInt32Array(),
|
||||||
|
"column": 1,
|
||||||
|
"folded_lines": Array[int]([]),
|
||||||
|
"h_scroll_position": 0,
|
||||||
|
"row": 42,
|
||||||
|
"scroll_position": 16.0,
|
||||||
"selection": false,
|
"selection": false,
|
||||||
"syntax_highlighter": "GDScript"
|
"syntax_highlighter": "GDScript"
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -0,0 +1,43 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
print(checkAndCorrectGrammar("A unicorn is a mythical creature"))
|
||||||
|
print(checkAndCorrectGrammar("An apple a day keeps the doctor away"))
|
||||||
|
print(checkAndCorrectGrammar("An house on the hill."))
|
||||||
|
print(checkAndCorrectGrammar("A egg a day is unhealthy."))
|
||||||
|
print(checkAndCorrectGrammar("An unique idea."))
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func checkAndCorrectGrammar(str: String) -> String:
|
||||||
|
var vowels: Array = ["a", "e", "i", "o", "u"]
|
||||||
|
var words: Array = str.split(" ")
|
||||||
|
var correctedStr: String = ""
|
||||||
|
|
||||||
|
for word in words:
|
||||||
|
var firstChar: String = word[0].to_lower()
|
||||||
|
if firstChar in vowels:
|
||||||
|
if word.substr(0, 2).to_lower() != "an":
|
||||||
|
word = "an " + word
|
||||||
|
print("Changed \"" + word + "\" to \"" + "an " + word + "\"")
|
||||||
|
else:
|
||||||
|
print("Kept \"" + word + "\"")
|
||||||
|
correctedStr += word + " "
|
||||||
|
else:
|
||||||
|
if word.substr(0, 1).to_lower() != "a":
|
||||||
|
if word.substr(1, 1) == "n":
|
||||||
|
word = word.substr(2, word.length())
|
||||||
|
print("Changed \"" + word + "\" to \"" + "a " + word + "\"")
|
||||||
|
else:
|
||||||
|
word = "a " + word
|
||||||
|
print("Changed \"" + word + "\" to \"" + "a " + word + "\"")
|
||||||
|
else:
|
||||||
|
print("Kept \"" + word + "\"")
|
||||||
|
correctedStr += word + " "
|
||||||
|
|
||||||
|
return correctedStr.strip_edges()
|
@ -0,0 +1,6 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://brx174ry2iceq"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Grammar/GrammarTest.gd" id="1_kk72l"]
|
||||||
|
|
||||||
|
[node name="GrammarTest" type="Node2D"]
|
||||||
|
script = ExtResource("1_kk72l")
|
Loading…
Reference in New Issue
Block a user